Package org.springframework.web.reactive
Class HandlerResult
java.lang.Object
org.springframework.web.reactive.HandlerResult
Represent the result of the invocation of a handler or a handler method.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionHandlerResult(Object handler, Object returnValue, MethodParameter returnType) Create a newHandlerResult.HandlerResult(Object handler, Object returnValue, MethodParameter returnType, BindingContext context) Create a newHandlerResult.
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<HandlerResult>applyExceptionHandler(Throwable failure) Apply the exception handler and return the alternative result.Return the BindingContext used for request handling.Return the handler that handled the request.getModel()Return the model used for request handling.Return the type of the value returned from the handler -- e.g.Return theMethodParameterfrom whichreturnTypewas created.Return the value returned from the handler, if any.booleanWhether there is an exception handler.setExceptionHandler(Function<Throwable, reactor.core.publisher.Mono<HandlerResult>> function) Configure an exception handler that may be used to produce an alternative result when result handling fails.
- 
Constructor Details- 
HandlerResultCreate a newHandlerResult.- Parameters:
- handler- the handler that handled the request
- returnValue- the return value from the handler possibly- null
- returnType- the return value type
 
- 
HandlerResultpublic HandlerResult(Object handler, @Nullable Object returnValue, MethodParameter returnType, @Nullable BindingContext context) Create a newHandlerResult.- Parameters:
- handler- the handler that handled the request
- returnValue- the return value from the handler possibly- null
- returnType- the return value type
- context- the binding context used for request handling
 
 
- 
- 
Method Details- 
getHandlerReturn the handler that handled the request.
- 
getReturnValueReturn the value returned from the handler, if any.
- 
getReturnTypeReturn the type of the value returned from the handler -- e.g. the return type declared on a controller method's signature. Also seegetReturnTypeSource()to obtain the underlyingMethodParameterfor the return type.
- 
getReturnTypeSourceReturn theMethodParameterfrom whichreturnTypewas created.
- 
getBindingContextReturn the BindingContext used for request handling.
- 
getModelReturn the model used for request handling. This is a shortcut forgetBindingContext().getModel().
- 
setExceptionHandlerpublic HandlerResult setExceptionHandler(Function<Throwable, reactor.core.publisher.Mono<HandlerResult>> function) Configure an exception handler that may be used to produce an alternative result when result handling fails. Especially for an async return value errors may occur after the invocation of the handler.- Parameters:
- function- the error handler
- Returns:
- the current instance
 
- 
hasExceptionHandlerpublic boolean hasExceptionHandler()Whether there is an exception handler.
- 
applyExceptionHandlerApply the exception handler and return the alternative result.- Parameters:
- failure- the exception
- Returns:
- the new result or the same error if there is no exception handler
 
 
-