WebFlux support for "request handled" in controller

Issue: SPR-16087
This commit is contained in:
Rossen Stoyanchev
2017-10-18 19:08:22 -04:00
parent a3eeda99e0
commit d8a7b96b46
5 changed files with 205 additions and 13 deletions

View File

@@ -1029,8 +1029,14 @@ from the request path.
|An API for model and view rendering scenarios.
|`void`
|For use in method that don't write the response body; or methods where the view name is
supposed to be determined implicitly from the request path.
|A method with a `void`, possibly async (e.g. `Mono<Void>`), return type (or a `null` return
value) is considered to have fully handled the response if it also has a `ServerHttpResponse`,
or a `ServerWebExchange` argument, or an `@ResponseStatus` annotation. The same is true also
if the controller has made a positive ETag or lastModified timestamp check.
// TODO (see <<webflux-caching-etag-lastmodified>> for details)
If none of the above is true, a `void` return type may also indicate "no response body" for
REST controllers, or default view name selection for HTML controllers.
|`Flux<ServerSentEvent>`, `Observable<ServerSentEvent>`, or other reactive type
|Emit server-sent events; the `SeverSentEvent` wrapper can be omitted when only data needs

View File

@@ -1684,9 +1684,13 @@ through a `RequestToViewNameTranslator`.
|The view and model attributes to use, and optionally a response status.
|`void`
|For use in methods that declare a `ServletResponse` or `OutputStream` argument and write
to the response body; or if the view name is supposed to be implicitly determined through a
`RequestToViewNameTranslator`.
|A method with a `void` return type (or `null` return value) is considered to have fully
handled the response if it also has a `ServletResponse`, or an `OutputStream` argument, or an
`@ResponseStatus` annotation. The same is true also if the controller has made a positive
ETag or lastModified timestamp check (see <<mvc-caching-etag-lastmodified>> for details).
If none of the above is true, a `void` return type may also indicate "no response body" for
REST controllers, or default view name selection for HTML controllers.
|`Callable<V>`
|Produce any of the above return values asynchronously in a Spring MVC managed thread.