Class HandlerResultHandlerSupport
java.lang.Object
org.springframework.web.reactive.result.HandlerResultHandlerSupport
- All Implemented Interfaces:
org.springframework.core.Ordered
- Direct Known Subclasses:
AbstractMessageWriterResultHandler
,ViewResolutionResultHandler
public abstract class HandlerResultHandlerSupport
extends Object
implements org.springframework.core.Ordered
Base class for
HandlerResultHandler
with support for content negotiation and access to a
ReactiveAdapter
registry.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ModifierConstructorDescriptionprotected
HandlerResultHandlerSupport
(RequestedContentTypeResolver contentTypeResolver, org.springframework.core.ReactiveAdapterRegistry adapterRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.core.ReactiveAdapter
getAdapter
(HandlerResult result) Get aReactiveAdapter
for the top-level return value type.org.springframework.core.ReactiveAdapterRegistry
Return the configuredReactiveAdapterRegistry
.Return the configuredRequestedContentTypeResolver
.int
getOrder()
protected org.springframework.http.MediaType
selectMediaType
(org.springframework.web.server.ServerWebExchange exchange, Supplier<List<org.springframework.http.MediaType>> producibleTypesSupplier) Select the best media type for the current request through a content negotiation algorithm.protected org.springframework.http.MediaType
selectMediaType
(org.springframework.web.server.ServerWebExchange exchange, Supplier<List<org.springframework.http.MediaType>> producibleTypesSupplier, List<org.springframework.http.MediaType> acceptableTypes) Variant ofselectMediaType(ServerWebExchange, Supplier)
with a given list of requested (acceptable) media types.void
setOrder
(int order) Set the order for this result handler relative to others.
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
HandlerResultHandlerSupport
protected HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver, org.springframework.core.ReactiveAdapterRegistry adapterRegistry)
-
-
Method Details
-
getAdapterRegistry
public org.springframework.core.ReactiveAdapterRegistry getAdapterRegistry()Return the configuredReactiveAdapterRegistry
. -
getContentTypeResolver
Return the configuredRequestedContentTypeResolver
. -
setOrder
public void setOrder(int order) Set the order for this result handler relative to others.By default set to
Ordered.LOWEST_PRECEDENCE
, however see Javadoc of subclasses which may change this default.- Parameters:
order
- the order
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
getAdapter
Get aReactiveAdapter
for the top-level return value type.- Returns:
- the matching adapter, or
null
if none
-
selectMediaType
@Nullable protected org.springframework.http.MediaType selectMediaType(org.springframework.web.server.ServerWebExchange exchange, Supplier<List<org.springframework.http.MediaType>> producibleTypesSupplier) Select the best media type for the current request through a content negotiation algorithm.- Parameters:
exchange
- the current requestproducibleTypesSupplier
- the media types producible for the request- Returns:
- the selected media type, or
null
if none
-
selectMediaType
@Nullable protected org.springframework.http.MediaType selectMediaType(org.springframework.web.server.ServerWebExchange exchange, Supplier<List<org.springframework.http.MediaType>> producibleTypesSupplier, List<org.springframework.http.MediaType> acceptableTypes) Variant ofselectMediaType(ServerWebExchange, Supplier)
with a given list of requested (acceptable) media types.
-