Class HandlerResult

java.lang.Object
org.springframework.web.reactive.HandlerResult

public class HandlerResult extends Object
Represent the result of the invocation of a handler or a handler method.
Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • HandlerResult

      public HandlerResult(Object handler, @Nullable Object returnValue, MethodParameter returnType)
      Create a new HandlerResult.
      Parameters:
      handler - the handler that handled the request
      returnValue - the return value from the handler possibly null
      returnType - the return value type
    • HandlerResult

      public HandlerResult(Object handler, @Nullable Object returnValue, MethodParameter returnType, @Nullable BindingContext context)
      Create a new HandlerResult.
      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

    • getHandler

      public Object getHandler()
      Return the handler that handled the request.
    • getReturnValue

      @Nullable public Object getReturnValue()
      Return the value returned from the handler, if any.
    • getReturnType

      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.
    • getReturnTypeSource

      public MethodParameter getReturnTypeSource()
      Return the MethodParameter from which returnType was created.
    • getBindingContext

      public BindingContext getBindingContext()
      Return the BindingContext used for request handling.
    • getModel

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

      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 - the exception handler to use
      Since:
      6.0
    • getExceptionHandler

      @Nullable public DispatchExceptionHandler getExceptionHandler()
      Return the configured exception handler.
      Since:
      6.0