Add support for Server-Sent Events

This commit adds ResponseBodyEmitter and SseEmitter (and also
ResponseEntity<ResponseBodyEmitter> and ResponseEntity<SseEmitter>) as
new return value types supported on @RequestMapping controller methods.

See Javadoc on respective types for more details.

Issue: SPR-12212
This commit is contained in:
Rossen Stoyanchev
2015-01-08 11:34:41 -05:00
parent ccb1c13951
commit a32b5e61d0
11 changed files with 1189 additions and 2 deletions

View File

@@ -31063,6 +31063,10 @@ The following are the supported return types:
value from a thread of its own choosing.
* A `ListenableFuture<?>` can be returned when the application wants to produce the return
value from a thread of its own choosing.
* A `ResponseBodyEmitter` can be returned to write multiple objects to the response
asynchronously; also supported as the body within a `ResponseEntity`.
* An `SseEmitter` can be returned to write Server-Sent Events to the response
asynchronously; also supported as the body within a `ResponseEntity`.
* Any other return type is considered to be a single model attribute to be exposed to
the view, using the attribute name specified through `@ModelAttribute` at the method
level (or the default attribute name based on the return type class name). The model