public class ResponseEntityResultHandler extends AbstractMessageWriterResultHandler implements HandlerResultHandler
HttpEntity
and ResponseEntity
return values.
By default the order for this result handler is set to 0. It is generally safe to place it early in the order as it looks for a concrete return type.
Modifier and Type | Field and Description |
---|---|
private static java.util.Set<HttpMethod> |
SAFE_METHODS |
logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
ResponseEntityResultHandler(java.util.List<HttpMessageWriter<?>> writers,
RequestedContentTypeResolver resolver)
Basic constructor with a default
ReactiveAdapterRegistry . |
ResponseEntityResultHandler(java.util.List<HttpMessageWriter<?>> writers,
RequestedContentTypeResolver resolver,
ReactiveAdapterRegistry registry)
Constructor with an
ReactiveAdapterRegistry instance. |
Modifier and Type | Method and Description |
---|---|
<any> |
handleResult(ServerWebExchange exchange,
HandlerResult result)
Process the given result modifying response headers and/or writing data
to the response.
|
private boolean |
isSupportedType(java.lang.Class<?> clazz) |
private static java.lang.Class<?> |
resolveReturnValueType(HandlerResult result) |
boolean |
supports(HandlerResult result)
Whether this handler supports the given
HandlerResult . |
getMessageWriters, writeBody, writeBody
getAdapter, getAdapterRegistry, getContentTypeResolver, getOrder, selectMediaType, setOrder
private static final java.util.Set<HttpMethod> SAFE_METHODS
public ResponseEntityResultHandler(java.util.List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver)
ReactiveAdapterRegistry
.writers
- writers for serializing to the response bodyresolver
- to determine the requested content typepublic ResponseEntityResultHandler(java.util.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)
HandlerResultHandler
HandlerResult
.supports
in interface HandlerResultHandler
result
- result object to check@Nullable private static java.lang.Class<?> resolveReturnValueType(HandlerResult result)
private boolean isSupportedType(@Nullable java.lang.Class<?> clazz)
public <any> handleResult(ServerWebExchange exchange, HandlerResult result)
HandlerResultHandler
handleResult
in interface HandlerResultHandler
exchange
- current server exchangeresult
- the result from the handlingMono<Void>
to indicate when request handling is complete.