Skip to content

Commit 0e7e95c

Browse files
committed
Polish
Issue: SPR-16009
1 parent 9d5a25e commit 0e7e95c

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

src/docs/asciidoc/web/webflux.adoc

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,7 @@ the classpath.
13931393

13941394
The `spring-webflux` module includes a non-blocking, reactive client for HTTP requests
13951395
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>>.
13981397

13991398
`WebClient` provides a higher level API over HTTP client libraries. By default
14001399
it uses https://github.com/reactor/reactor-netty[Reactor Netty] but that is pluggable
@@ -1415,7 +1414,7 @@ non-blocking I/O.
14151414
[[webflux-client-retrieve]]
14161415
=== Retrieve
14171416

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:
14191418

14201419
[source,java,intent=0]
14211420
[subs="verbatim,quotes"]
@@ -1428,7 +1427,7 @@ The `retrieve()` method is the easiest way to get a decoded response body:
14281427
.bodyToMono(Person.class);
14291428
----
14301429

1431-
You can also get a stream of decoded objects:
1430+
You can also get a stream of objects decoded from the response:
14321431

14331432
[source,java,intent=0]
14341433
[subs="verbatim,quotes"]
@@ -1439,7 +1438,7 @@ You can also get a stream of decoded objects:
14391438
.bodyToFlux(Quote.class);
14401439
----
14411440

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
14431442
`WebClientResponseException` but you can customize that:
14441443

14451444
[source,java,intent=0]
@@ -1459,7 +1458,7 @@ By default, a response with 4xx or 5xx status code results in an error of type
14591458
=== Exchange
14601459

14611460
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`:
14631462

14641463
[source,java,intent=0]
14651464
[subs="verbatim,quotes"]
@@ -1514,7 +1513,7 @@ The request body can be encoded from an Object:
15141513
.bodyToMono(Void.class);
15151514
----
15161515

1517-
You can also encode from a stream of objects:
1516+
You can also have a stream of objects encoded:
15181517

15191518
[source,java,intent=0]
15201519
[subs="verbatim,quotes"]
@@ -1529,7 +1528,7 @@ You can also encode from a stream of objects:
15291528
.bodyToMono(Void.class);
15301529
----
15311530

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:
15331532

15341533
[source,java,intent=0]
15351534
[subs="verbatim,quotes"]
@@ -1550,9 +1549,9 @@ Or if you have the actual value, use the `syncBody` shortcut:
15501549

15511550
A simple way to create `WebClient` is through the static factory methods `create()` and
15521551
`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.
15541553

1555-
To customize options of the underlying HTTP client:
1554+
To customize the underlying HTTP client:
15561555

15571556
[source,java,intent=0]
15581557
[subs="verbatim,quotes"]
@@ -1567,7 +1566,7 @@ To customize options of the underlying HTTP client:
15671566
.build();
15681567
----
15691568

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:
15711570

15721571
[source,java,intent=0]
15731572
[subs="verbatim,quotes"]
@@ -1586,19 +1585,18 @@ To customize <<webflux-codecs,HTTP codecs>> used for encoding and decoding:
15861585

15871586
The builder can be used to insert <<webflux-client-filter>>.
15881587

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.
15911590

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:
15941593

15951594
[source,java,intent=0]
15961595
[subs="verbatim,quotes"]
15971596
----
15981597
WebClient modifiedClient = client.mutate()
15991598
// user builder methods...
16001599
.build();
1601-
16021600
----
16031601

16041602

@@ -1669,14 +1667,15 @@ with proper translation of cardinality. This is done with the help of the
16691667
`spring-core` which provides pluggable support for reactive and async types. The registry
16701668
has built-in support for RxJava and `CompletableFuture` but others can be registered.
16711669

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:
16731672

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
16751674
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`.
16801679

16811680
[NOTE]
16821681
====

0 commit comments

Comments
 (0)