Top Description Fields Constructors Methods
org.springframework.web.reactive.result

public abstract Class HandlerResultHandlerSupport

extends Object
implements Ordered
Class Inheritance
All Implemented Interfaces
org.springframework.core.Ordered
Known Direct Subclasses
org.springframework.web.reactive.result.method.annotation.AbstractMessageWriterResultHandler, org.springframework.web.reactive.result.view.ViewResolutionResultHandler
Imports
java.util.ArrayList, .LinkedHashSet, .List, .Set, java.util.function.Supplier, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.Ordered, .ReactiveAdapter, .ReactiveAdapterRegistry, org.springframework.http.MediaType, org.springframework.lang.Nullable, org.springframework.util.Assert, .MimeTypeUtils, org.springframework.web.reactive.HandlerMapping, .HandlerResult, org.springframework.web.reactive.accept.RequestedContentTypeResolver, org.springframework.web.server.ServerWebExchange

Base class for HandlerResultHandler with support for content negotiation and access to a ReactiveAdapter registry.
Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private final ReactiveAdapterRegistry
private static final List<MediaType>
private final RequestedContentTypeResolver
protected final Log
private int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private List<MediaType>
protected ReactiveAdapter

Returns:

the matching adapter, or null if none
getAdapter
(HandlerResult result)

Get a ReactiveAdapter for the top-level return value type.

public ReactiveAdapterRegistry
public RequestedContentTypeResolver
public int
getOrder()

Implements org.springframework.core.Ordered.getOrder.

Get the order value of this object.

private List<MediaType>
getProducibleTypes(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)

protected MediaType

Returns:

the selected media type, or null if none
selectMediaType
(ServerWebExchange
the current request
exchange
,
Supplier<List<MediaType>>
the media types producible for the request
producibleTypesSupplier
)

Select the best media type for the current request through a content negotiation algorithm.

protected MediaType
selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier, List<MediaType> acceptableTypes)

Variant of selectMediaType(ServerWebExchange, Supplier) with a given list of requested (acceptable) media types.

private MediaType
public void
setOrder(int
the order
order
)

Set the order for this result handler relative to others.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

adapterRegistryback to summary
private final ReactiveAdapterRegistry adapterRegistry
ALL_APPLICATION_MEDIA_TYPESback to summary
private static final List<MediaType> ALL_APPLICATION_MEDIA_TYPES
contentTypeResolverback to summary
private final RequestedContentTypeResolver contentTypeResolver
loggerback to summary
protected final Log logger
orderback to summary
private int order

Constructor Detail

HandlerResultHandlerSupportback to summary
protected HandlerResultHandlerSupport(RequestedContentTypeResolver contentTypeResolver, ReactiveAdapterRegistry adapterRegistry)

Method Detail

getAcceptableTypesback to summary
private List<MediaType> getAcceptableTypes(ServerWebExchange exchange)
getAdapterback to summary
protected ReactiveAdapter getAdapter(HandlerResult result)

Get a ReactiveAdapter for the top-level return value type.

Returns:ReactiveAdapter

the matching adapter, or null if none

Annotations
@Nullable
getAdapterRegistryback to summary
public ReactiveAdapterRegistry getAdapterRegistry()

Return the configured ReactiveAdapterRegistry.

getContentTypeResolverback to summary
public RequestedContentTypeResolver getContentTypeResolver()

Return the configured RequestedContentTypeResolver.

getOrderback to summary
public int getOrder()

Implements org.springframework.core.Ordered.getOrder.

Doc from org.springframework.core.Ordered.getOrder.

Get the order value of this object.

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.

Returns:int

the order value

Annotations
@Override
getProducibleTypesback to summary
private List<MediaType> getProducibleTypes(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)
selectMediaTypeback to summary
protected MediaType selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)

Select the best media type for the current request through a content negotiation algorithm.

Parameters
exchange:ServerWebExchange

the current request

producibleTypesSupplier:Supplier<List<MediaType>>

the media types producible for the request

Returns:MediaType

the selected media type, or null if none

Annotations
@Nullable
selectMediaTypeback to summary
protected MediaType selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier, List<MediaType> acceptableTypes)

Variant of selectMediaType(ServerWebExchange, Supplier) with a given list of requested (acceptable) media types.

Annotations
@Nullable
selectMoreSpecificMediaTypeback to summary
private MediaType selectMoreSpecificMediaType(MediaType acceptable, MediaType producible)
setOrderback to summary
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:int

the order