public class ResponseBodyResultHandler extends AbstractMessageWriterResultHandler implements HandlerResultHandler
HandlerResultHandler that handles return values from methods annotated
with @ResponseBody writing to the body of the request or response with
an HttpMessageWriter.
By default the order for this result handler is set to 100. As it detects
the presence of @ResponseBody it should be ordered after result
handlers that look for a specific return type. Note however that this handler
does recognize and explicitly ignores the ResponseEntity return type.
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers,
RequestedContentTypeResolver resolver)
Basic constructor with a default
ReactiveAdapterRegistry. |
ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers,
RequestedContentTypeResolver resolver,
ReactiveAdapterRegistry registry)
Constructor with an
ReactiveAdapterRegistry instance. |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<Void> |
handleResult(ServerWebExchange exchange,
HandlerResult result)
Process the given result modifying response headers and/or writing data
to the response.
|
boolean |
supports(HandlerResult result)
Whether this handler supports the given
HandlerResult. |
getMessageWriters, writeBody, writeBodygetAdapter, getAdapterRegistry, getContentTypeResolver, getOrder, selectMediaType, setOrderpublic ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver)
ReactiveAdapterRegistry.writers - writers for serializing to the response bodyresolver - to determine the requested content typepublic ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver, ReactiveAdapterRegistry registry)
ReactiveAdapterRegistry instance.writers - writers for serializing to the response bodyresolver - to determine the requested content typeregistry - for adaptation to reactive typespublic boolean supports(HandlerResult result)
HandlerResultHandlerHandlerResult.supports in interface HandlerResultHandlerresult - result object to checkpublic reactor.core.publisher.Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result)
HandlerResultHandlerhandleResult in interface HandlerResultHandlerexchange - current server exchangeresult - the result from the handlingMono<Void> to indicate when request handling is complete.