public class ServerResponseResultHandler extends Object implements HandlerResultHandler, InitializingBean, Ordered
HandlerResultHandler
implementation that supports ServerResponses
.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
ServerResponseResultHandler() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , 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 given
HandlerResult . |
public void setMessageWriters(List<HttpMessageWriter<?>> configurer)
By default this is set to ServerCodecConfigurer
's default writers.
public void setViewResolvers(List<ViewResolver> viewResolvers)
public void setOrder(int order)
By default set to 0. It is generally safe to place it early in the order as it looks for a concrete return type.
public 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
public void afterPropertiesSet() throws Exception
InitializingBean
BeanFactory
after it has set all bean properties
and satisfied BeanFactoryAware
, 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.
afterPropertiesSet
in interface InitializingBean
Exception
- in the event of misconfiguration (such as failure to set an
essential property) or if initialization fails for any other reasonpublic boolean supports(HandlerResult result)
HandlerResultHandler
HandlerResult
.supports
in interface HandlerResultHandler
result
- the result object to checkpublic reactor.core.publisher.Mono<Void> 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.