@@ -1393,8 +1393,7 @@ the classpath.
1393
1393
1394
1394
The `spring-webflux` module includes a non-blocking, reactive client for HTTP requests
1395
1395
with Reactive Streams back pressure. It shares <<webflux-codecs,HTTP codecs>> and other
1396
- infrastructure with the server <<webflux-functional.adoc#webflux-fn,functional web
1397
- framework>>.
1396
+ infrastructure with the server <<webflux-fn,functional web framework>>.
1398
1397
1399
1398
`WebClient` provides a higher level API over HTTP client libraries. By default
1400
1399
it uses https://github.com/reactor/reactor-netty[Reactor Netty] but that is pluggable
@@ -1415,7 +1414,7 @@ non-blocking I/O.
1415
1414
[[webflux-client-retrieve]]
1416
1415
=== Retrieve
1417
1416
1418
- The `retrieve()` method is the easiest way to get a decoded response body:
1417
+ The `retrieve()` method is the easiest way to get a response body and decode it :
1419
1418
1420
1419
[source,java,intent=0]
1421
1420
[subs="verbatim,quotes"]
@@ -1428,7 +1427,7 @@ The `retrieve()` method is the easiest way to get a decoded response body:
1428
1427
.bodyToMono(Person.class);
1429
1428
----
1430
1429
1431
- You can also get a stream of decoded objects :
1430
+ You can also get a stream of objects decoded from the response :
1432
1431
1433
1432
[source,java,intent=0]
1434
1433
[subs="verbatim,quotes"]
@@ -1439,7 +1438,7 @@ You can also get a stream of decoded objects:
1439
1438
.bodyToFlux(Quote.class);
1440
1439
----
1441
1440
1442
- By default, a response with 4xx or 5xx status code results in an error of type
1441
+ By default, responses with 4xx or 5xx status codes result in an error of type
1443
1442
`WebClientResponseException` but you can customize that:
1444
1443
1445
1444
[source,java,intent=0]
@@ -1459,7 +1458,7 @@ By default, a response with 4xx or 5xx status code results in an error of type
1459
1458
=== Exchange
1460
1459
1461
1460
The `exchange()` method provides more control. The below example is equivalent
1462
- to `retrieve()` but with access to the `ClientResponse`:
1461
+ to `retrieve()` but also provides access to the `ClientResponse`:
1463
1462
1464
1463
[source,java,intent=0]
1465
1464
[subs="verbatim,quotes"]
@@ -1514,7 +1513,7 @@ The request body can be encoded from an Object:
1514
1513
.bodyToMono(Void.class);
1515
1514
----
1516
1515
1517
- You can also encode from a stream of objects:
1516
+ You can also have a stream of objects encoded :
1518
1517
1519
1518
[source,java,intent=0]
1520
1519
[subs="verbatim,quotes"]
@@ -1529,7 +1528,7 @@ You can also encode from a stream of objects:
1529
1528
.bodyToMono(Void.class);
1530
1529
----
1531
1530
1532
- Or if you have the actual value, use the `syncBody` shortcut:
1531
+ Or if you have the actual value, use the `syncBody` shortcut method :
1533
1532
1534
1533
[source,java,intent=0]
1535
1534
[subs="verbatim,quotes"]
@@ -1550,9 +1549,9 @@ Or if you have the actual value, use the `syncBody` shortcut:
1550
1549
1551
1550
A simple way to create `WebClient` is through the static factory methods `create()` and
1552
1551
`create(String)` with a base URL for all requests. You can also use `WebClient.builder()`
1553
- for further options.
1552
+ for access to more options.
1554
1553
1555
- To customize options of the underlying HTTP client:
1554
+ To customize the underlying HTTP client:
1556
1555
1557
1556
[source,java,intent=0]
1558
1557
[subs="verbatim,quotes"]
@@ -1567,7 +1566,7 @@ To customize options of the underlying HTTP client:
1567
1566
.build();
1568
1567
----
1569
1568
1570
- To customize <<webflux-codecs,HTTP codecs>> used for encoding and decoding:
1569
+ To customize the <<webflux-codecs,HTTP codecs>> used for encoding and decoding HTTP messages :
1571
1570
1572
1571
[source,java,intent=0]
1573
1572
[subs="verbatim,quotes"]
@@ -1586,19 +1585,18 @@ To customize <<webflux-codecs,HTTP codecs>> used for encoding and decoding:
1586
1585
1587
1586
The builder can be used to insert <<webflux-client-filter>>.
1588
1587
1589
- You can also customize URI building, set default headers, cookies, and more. Explore
1590
- the `WebClient.Builder` in your IDE .
1588
+ Explore the `WebClient.Builder` in your IDE for other options related to URI building,
1589
+ default headers (and cookies), and more .
1591
1590
1592
- Note that you can also obtain a builder from an already existing `WebClient` instance
1593
- and create a modified version without affecting the original instance:
1591
+ After the `WebClient` is built, you can always obtain a new builder from it, in order to
1592
+ build a new `WebClient`, based on, but without affecting the current instance:
1594
1593
1595
1594
[source,java,intent=0]
1596
1595
[subs="verbatim,quotes"]
1597
1596
----
1598
1597
WebClient modifiedClient = client.mutate()
1599
1598
// user builder methods...
1600
1599
.build();
1601
-
1602
1600
----
1603
1601
1604
1602
@@ -1669,14 +1667,15 @@ with proper translation of cardinality. This is done with the help of the
1669
1667
`spring-core` which provides pluggable support for reactive and async types. The registry
1670
1668
has built-in support for RxJava and `CompletableFuture` but others can be registered.
1671
1669
1672
- For functional endpoints and other functional APIs such as the `WebClient`:
1670
+ For functional endpoints, the `WebClient`, and other functional APIs, the general rule
1671
+ of thumb for WebFlux APIs applies:
1673
1672
1674
- * `Flux` or `Mono` for output -- use them to compose logic or pass to any Reactive
1673
+ * `Flux` or `Mono` as return values -- use them to compose logic or pass to any Reactive
1675
1674
Streams library (both are `Publisher` implementations).
1676
- * `Publisher` for input -- if a `Publisher` from another reactive library is provided
1677
- it can only be treated as a stream with unknown semantics (0..N). If the semantics are
1678
- known -- e.g. `io.reactivex.Single`, you can use `Mono.from(Publisher)` and pass that
1679
- in instead of the raw `Publisher`.
1675
+ * Reactive Streams `Publisher` for input -- if a `Publisher` from another reactive library
1676
+ is provided it can only be treated as a stream with unknown semantics (0..N). If the
1677
+ semantics are known -- e.g. `io.reactivex.Single`, you can use `Mono.from(Publisher)` and
1678
+ pass that in instead of the raw `Publisher`.
1680
1679
1681
1680
[NOTE]
1682
1681
====
0 commit comments