@ -125,7 +125,7 @@ For more on that, see <<web-reactive.adoc#webflux-reactive-libraries, Reactive L
@@ -125,7 +125,7 @@ For more on that, see <<web-reactive.adoc#webflux-reactive-libraries, Reactive L
[[webflux-fn-request]]
=== `ServerRequest`
=== ServerRequest
`ServerRequest` provides access to the HTTP method, URI, headers, and query parameters,
while access to the body is provided through the `body` methods.
@ -218,7 +218,7 @@ val parts = request.body(BodyExtractors.toParts()).asFlow()
@@ -218,7 +218,7 @@ val parts = request.body(BodyExtractors.toParts()).asFlow()
[[webflux-fn-response]]
=== `ServerResponse`
=== ServerResponse
`ServerResponse` provides access to the HTTP response and, since it is immutable, you can use
a `build` method to create it. You can use the builder to set the response status, to add response
@ -117,7 +117,7 @@ access to the HTTP request and response, including headers, body, method, and st
@@ -117,7 +117,7 @@ access to the HTTP request and response, including headers, body, method, and st
[[webmvc-fn-request]]
=== `ServerRequest`
=== ServerRequest
`ServerRequest` provides access to the HTTP method, URI, headers, and query parameters,
while access to the body is provided through the `body` methods.
@ -165,7 +165,7 @@ val map = request.params()
@@ -165,7 +165,7 @@ val map = request.params()
[[webmvc-fn-response]]
=== `ServerResponse`
=== ServerResponse
`ServerResponse` provides access to the HTTP response and, since it is immutable, you can use
a `build` method to create it. You can use the builder to set the response status, to add response
@ -200,6 +200,35 @@ val location: URI = ...
@@ -200,6 +200,35 @@ val location: URI = ...
ServerResponse.created(location).build()
----
You can also use an asynchronous result as the body, in the form of a `CompletableFuture`,
`Publisher`, or any other type supported by the `ReactiveAdapterRegistry`. For instance:
[source,java,role="primary"]
.Java
----
Mono<Person> person = webClient.get().retrieve().bodyToMono(Person.class);