Document choices for async ResponseEntity return values
Closes gh-22614
This commit is contained in:
@@ -2993,7 +2993,17 @@ configure or customize message writing.
|
||||
|
||||
WebFlux supports using a single value <<webflux-reactive-libraries, reactive type>> to
|
||||
produce the `ResponseEntity` asynchronously, and/or single and multi-value reactive types
|
||||
for the body.
|
||||
for the body. This allows a variety of async responses with `ResponseEntity` as follows:
|
||||
|
||||
* `ResponseEntity<Mono<T>>` or `ResponseEntity<Flux<T>>` make the response status and
|
||||
headers known immediately while the body is provided asynchronously at a later point.
|
||||
Use `Mono` if the body consists of 0..1 values or `Flux` if it can produce multiple values.
|
||||
* `Mono<ResponseEntity<T>>` provides all three -- response status, headers, and body,
|
||||
asynchronously at a later point. This allows the response status and headers to vary
|
||||
depending on the outcome of asynchronous request handling.
|
||||
* `Mono<ResponseEntity<Mono<T>>>` or `Mono<ResponseEntity<Flux<T>>>` are yet another
|
||||
possible, albeit less common alternative. They provides the response status and headers
|
||||
asynchronously first and then the response body, also asynchronously at a second point later.
|
||||
|
||||
|
||||
[[webflux-ann-jackson]]
|
||||
|
||||
@@ -3316,7 +3316,14 @@ See <<mvc-ann-jackson>> for details.
|
||||
|
||||
Spring MVC supports using a single value <<mvc-ann-async-reactive-types, reactive type>>
|
||||
to produce the `ResponseEntity` asynchronously, and/or single and multi-value reactive
|
||||
types for the body.
|
||||
types for the body. This allows the following types of async responses:
|
||||
|
||||
* `ResponseEntity<Mono<T>>` or `ResponseEntity<Flux<T>>` make the response status and
|
||||
headers known immediately while the body is provided asynchronously at a later point.
|
||||
Use `Mono` if the body consists of 0..1 values or `Flux` if it can produce multiple values.
|
||||
* `Mono<ResponseEntity<T>>` provides all three -- response status, headers, and body,
|
||||
asynchronously at a later point. This allows the response status and headers to vary
|
||||
depending on the outcome of asynchronous request handling.
|
||||
|
||||
|
||||
[[mvc-ann-jackson]]
|
||||
|
||||
Reference in New Issue
Block a user