public abstract class HandlerResultHandlerSupport extends Object implements Ordered
HandlerResultHandler
with support for content negotiation and access to a
ReactiveAdapter
registry.Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Modifier | Constructor and Description |
---|---|
protected |
HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver,
ReactiveAdapterRegistry adapterRegistry) |
Modifier and Type | Method and Description |
---|---|
protected ReactiveAdapter |
getAdapter(HandlerResult result)
Get a
ReactiveAdapter for the top-level return value type. |
ReactiveAdapterRegistry |
getAdapterRegistry()
Return the configured
ReactiveAdapterRegistry . |
RequestedContentTypeResolver |
getContentTypeResolver()
Return the configured
RequestedContentTypeResolver . |
int |
getOrder()
Get the order value of this object.
|
protected MediaType |
selectMediaType(ServerWebExchange exchange,
Supplier<List<MediaType>> producibleTypesSupplier)
Select the best media type for the current request through a content negotiation algorithm.
|
void |
setOrder(int order)
Set the order for this result handler relative to others.
|
protected final Log logger
protected HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry)
public ReactiveAdapterRegistry getAdapterRegistry()
ReactiveAdapterRegistry
.public RequestedContentTypeResolver getContentTypeResolver()
RequestedContentTypeResolver
.public void setOrder(int order)
By default set to Ordered.LOWEST_PRECEDENCE
, however see
Javadoc of subclasses which may change this default.
order
- the orderpublic int getOrder()
Ordered
Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet load-on-startup
values).
Same order values will result in arbitrary sort positions for the affected objects.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE
@Nullable protected ReactiveAdapter getAdapter(HandlerResult result)
ReactiveAdapter
for the top-level return value type.null
if none@Nullable protected MediaType selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)
exchange
- the current requestproducibleTypesSupplier
- the media types that can be produced for the current requestnull
if none