Browse Source

Update ref docs on ResponseEntity and reactive types

Issue: SPR-17400
pull/1999/head
Rossen Stoyanchev 8 years ago
parent
commit
2eae37dde0
  1. 16
      src/docs/asciidoc/web/webflux.adoc
  2. 25
      src/docs/asciidoc/web/webmvc.adoc

16
src/docs/asciidoc/web/webflux.adoc

@ -2414,22 +2414,26 @@ configure or customize message writing.
==== `ResponseEntity` ==== `ResponseEntity`
[.small]#<<web.adoc#mvc-ann-responseentity,Same as in Spring MVC>># [.small]#<<web.adoc#mvc-ann-responseentity,Same as in Spring MVC>>#
Using `ResponseEntity` is more or less identical to using <<webflux-ann-responsebody>> but is based `ResponseEntity` is like <<webflux-ann-responsebody>> but with status and headers. For example:
on a container object that specifies request headers and body. The following example uses `ResponseEntity`:
==== ====
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@PostMapping("/something") @GetMapping("/something")
public ResponseEntity<String> handle() { public ResponseEntity<String> handle() {
// ... String body = ... ;
URI location = ... String etag = ... ;
return new ResponseEntity.created(location).build(); return ResponseEntity.ok().eTag(etag).build(body);
} }
---- ----
==== ====
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.
[[webflux-ann-jackson]] [[webflux-ann-jackson]]

25
src/docs/asciidoc/web/webmvc.adoc

@ -2789,22 +2789,26 @@ See <<mvc-ann-jackson>> for details.
==== ResponseEntity ==== ResponseEntity
[.small]#<<web-reactive.adoc#webflux-ann-responseentity,Same as in Spring WebFlux>># [.small]#<<web-reactive.adoc#webflux-ann-responseentity,Same as in Spring WebFlux>>#
`ResponseEntity` is more or less identical to using <<mvc-ann-responsebody>> but is based `ResponseEntity` is like <<mvc-ann-responsebody>> but with status and headers. For example:
on a container object that specifies request headers and body. The following listing shows an example:
==== ====
[source,java,indent=0] [source,java,indent=0]
[subs="verbatim,quotes"] [subs="verbatim,quotes"]
---- ----
@PostMapping("/something") @GetMapping("/something")
public ResponseEntity<String> handle() { public ResponseEntity<String> handle() {
// ... String body = ... ;
URI location = ... ; String etag = ... ;
return ResponseEntity.created(location).build(); return ResponseEntity.ok().eTag(etag).build(body);
} }
---- ----
==== ====
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.
[[mvc-ann-jackson]] [[mvc-ann-jackson]]
@ -3854,10 +3858,11 @@ customize the status and headers of the response.
=== Reactive Types === Reactive Types
[.small]#<<web-reactive.adoc#webflux-codecs-streaming,Same as in Spring WebFlux>># [.small]#<<web-reactive.adoc#webflux-codecs-streaming,Same as in Spring WebFlux>>#
Spring MVC supports use of reactive client libraries in a controller. This includes the Spring MVC supports use of reactive client libraries in a controller (also read
`WebClient` from `spring-webflux` and others, such as Spring Data reactive data <<web-reactive.adoc#webflux-reactive-libraries,Reactive Libraries>> in the WebFlux section).
repositories. In such scenarios, it is convenient to be able to return reactive types This includes the `WebClient` from `spring-webflux` and others, such as Spring Data
from the controller method . reactive data repositories. In such scenarios, it is convenient to be able to return
reactive types from the controller method.
Reactive return values are handled as follows: Reactive return values are handled as follows:

Loading…
Cancel
Save