Class ServerResponseResultHandler
java.lang.Object
org.springframework.web.reactive.function.server.support.ServerResponseResultHandler
- All Implemented Interfaces:
InitializingBean
,Ordered
,HandlerResultHandler
public class ServerResponseResultHandler
extends Object
implements HandlerResultHandler, InitializingBean, Ordered
HandlerResultHandler
implementation that supports ServerResponses
.- Since:
- 5.0
- Author:
- Arjen Poutsma
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.int
getOrder()
Get the order value of this object.reactor.core.publisher.Mono<Void>
handleResult
(ServerWebExchange exchange, HandlerResult result) Process the given result modifying response headers and/or writing data to the response.void
setMessageWriters
(List<HttpMessageWriter<?>> configurer) Configure HTTP message writers to serialize the request body with.void
setOrder
(int order) Set the order for this result handler relative to others.void
setViewResolvers
(List<ViewResolver> viewResolvers) boolean
supports
(HandlerResult result) Whether this handler supports the givenHandlerResult
.
-
Constructor Details
-
ServerResponseResultHandler
public ServerResponseResultHandler()
-
-
Method Details
-
setMessageWriters
Configure HTTP message writers to serialize the request body with.By default this is set to
ServerCodecConfigurer
's default writers. -
setViewResolvers
-
setOrder
public void setOrder(int order) Set the order for this result handler relative to others.By default set to 0. It is generally safe to place it early in the order as it looks for a concrete return type.
-
getOrder
public int getOrder()Description copied from interface:Ordered
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.
-
afterPropertiesSet
Description copied from interface:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
-
supports
Description copied from interface:HandlerResultHandler
Whether this handler supports the givenHandlerResult
.- Specified by:
supports
in interfaceHandlerResultHandler
- Parameters:
result
- the result object to check- Returns:
- whether this object can use the given result
-
handleResult
public reactor.core.publisher.Mono<Void> handleResult(ServerWebExchange exchange, HandlerResult result) Description copied from interface:HandlerResultHandler
Process the given result modifying response headers and/or writing data to the response.- Specified by:
handleResult
in interfaceHandlerResultHandler
- Parameters:
exchange
- current server exchangeresult
- the result from the handling- Returns:
Mono<Void>
to indicate when request handling is complete.
-