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

public Class HandlerResult

extends Object
Class Inheritance
Imports
java.util.function.Function, reactor.core.publisher.Mono, org.springframework.core.MethodParameter, .ResolvableType, org.springframework.lang.Nullable, org.springframework.ui.Model, org.springframework.util.Assert

Represent the result of the invocation of a handler or a handler method.
Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private final BindingContext
private DispatchExceptionHandler
private Function<Throwable, Mono<HandlerResult>>
private final Object
private final ResolvableType
private final Object

Constructor Summary

AccessConstructor and Description
public
HandlerResult(Object
the handler that handled the request
handler
,
Object
the return value from the handler possibly null
returnValue
,
MethodParameter
the return value type
returnType
)

Create a new HandlerResult.

public
HandlerResult(Object
the handler that handled the request
handler
,
Object
the return value from the handler possibly null
returnValue
,
MethodParameter
the return value type
returnType
,
BindingContext
the binding context used for request handling
context
)

Create a new HandlerResult.

Method Summary

Modifier and TypeMethod and Description
public Mono<HandlerResult>

Returns:

the new result or the same error if there is no exception handler
applyExceptionHandler
(Throwable
the exception
failure
)
Deprecated for removal since 6.0. without a replacement; for internal invocation only, not used as of 6.0

Apply the exception handler and return the alternative result.

public BindingContext
getBindingContext()

Return the BindingContext used for request handling.

public DispatchExceptionHandler
getExceptionHandler()

Return the configured exception handler.

public Object
getHandler()

Return the handler that handled the request.

public Model
getModel()

Return the model used for request handling.

public ResolvableType
getReturnType()

Return the type of the value returned from the handler -- e.g. the return type declared on a controller method's signature.

public MethodParameter
getReturnTypeSource()

Return the MethodParameter from which returnType was created.

public Object
getReturnValue()

Return the value returned from the handler, if any.

public boolean
hasExceptionHandler()
Deprecated for removal since 6.0. in favor of checking via getExceptionHandler()

Whether there is an exception handler.

public HandlerResult
setExceptionHandler(DispatchExceptionHandler
the exception handler to use
exceptionHandler
)

HandlerAdapter classes can set this to have their exception handling mechanism applied to response rendering and to deferred exceptions when invoking a handler with an asynchronous return value.

public HandlerResult

Returns:

the current instance
setExceptionHandler
(Function<Throwable, Mono<HandlerResult>>
the error handler
function
)
Deprecated for removal since 6.0. in favor of setExceptionHandler(DispatchExceptionHandler)

HandlerAdapter classes can set this to have their exception handling mechanism applied to response rendering and to deferred exceptions when invoking a handler with an asynchronous return value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bindingContextback to summary
private final BindingContext bindingContext
exceptionHandlerback to summary
private DispatchExceptionHandler exceptionHandler
Annotations
@Nullable
exceptionHandlerFunctionback to summary
private Function<Throwable, Mono<HandlerResult>> exceptionHandlerFunction
Annotations
@Nullable
handlerback to summary
private final Object handler
returnTypeback to summary
private final ResolvableType returnType
returnValueback to summary
private final Object returnValue
Annotations
@Nullable

Constructor Detail

HandlerResultback to summary
public HandlerResult(Object handler, Object returnValue, MethodParameter returnType)

Create a new HandlerResult.

Parameters
handler:Object

the handler that handled the request

returnValue:Object

the return value from the handler possibly null

returnType:MethodParameter

the return value type

HandlerResultback to summary
public HandlerResult(Object handler, Object returnValue, MethodParameter returnType, BindingContext context)

Create a new HandlerResult.

Parameters
handler:Object

the handler that handled the request

returnValue:Object

the return value from the handler possibly null

returnType:MethodParameter

the return value type

context:BindingContext

the binding context used for request handling

Method Detail

applyExceptionHandlerback to summary
public Mono<HandlerResult> applyExceptionHandler(Throwable failure)

Deprecated

for removal since 6.0.

without a replacement; for internal invocation only, not used as of 6.0

Apply the exception handler and return the alternative result.

Parameters
failure:Throwable

the exception

Returns:Mono<HandlerResult>

the new result or the same error if there is no exception handler

Annotations
@Deprecated
since:6.0
forRemoval:true
getBindingContextback to summary
public BindingContext getBindingContext()

Return the BindingContext used for request handling.

getExceptionHandlerback to summary
public DispatchExceptionHandler getExceptionHandler()

Return the configured exception handler.

Annotations
@Nullable
Since
6.0
getHandlerback to summary
public Object getHandler()

Return the handler that handled the request.

getModelback to summary
public Model getModel()

Return the model used for request handling. This is a shortcut for getBindingContext().getModel().

getReturnTypeback to summary
public ResolvableType getReturnType()

Return the type of the value returned from the handler -- e.g. the return type declared on a controller method's signature. Also see getReturnTypeSource() to obtain the underlying MethodParameter for the return type.

getReturnTypeSourceback to summary
public MethodParameter getReturnTypeSource()

Return the MethodParameter from which returnType was created.

getReturnValueback to summary
public Object getReturnValue()

Return the value returned from the handler, if any.

Annotations
@Nullable
hasExceptionHandlerback to summary
public boolean hasExceptionHandler()

Deprecated

for removal since 6.0.

in favor of checking via getExceptionHandler()

Whether there is an exception handler.

Annotations
@Deprecated
since:6.0
forRemoval:true
setExceptionHandlerback to summary
public HandlerResult setExceptionHandler(DispatchExceptionHandler exceptionHandler)

HandlerAdapter classes can set this to have their exception handling mechanism applied to response rendering and to deferred exceptions when invoking a handler with an asynchronous return value.

Parameters
exceptionHandler:DispatchExceptionHandler

the exception handler to use

Since
6.0
setExceptionHandlerback to summary
public HandlerResult setExceptionHandler(Function<Throwable, Mono<HandlerResult>> function)

Deprecated

for removal since 6.0.

in favor of setExceptionHandler(DispatchExceptionHandler)

HandlerAdapter classes can set this to have their exception handling mechanism applied to response rendering and to deferred exceptions when invoking a handler with an asynchronous return value.

Parameters
function:Function<Throwable, Mono<HandlerResult>>

the error handler

Returns:HandlerResult

the current instance

Annotations
@Deprecated
since:6.0
forRemoval:true