Class ServletInvocableHandlerMethod

java.lang.Object
org.springframework.core.annotation.AnnotatedMethod
org.springframework.web.method.HandlerMethod
org.springframework.web.method.support.InvocableHandlerMethod
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod

public class ServletInvocableHandlerMethod extends org.springframework.web.method.support.InvocableHandlerMethod
Extends InvocableHandlerMethod with the ability to handle return values through a registered HandlerMethodReturnValueHandler and also supports setting the response status based on a method-level @ResponseStatus annotation.

A null return value (including void) may be interpreted as the end of request processing in combination with a @ResponseStatus annotation, a not-modified check condition (see ServletWebRequest.checkNotModified(long)), or a method argument that provides access to the response stream.

Since:
3.1
Author:
Rossen Stoyanchev, Juergen Hoeller
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.core.annotation.AnnotatedMethod

    org.springframework.core.annotation.AnnotatedMethod.AnnotatedMethodParameter
  • Field Summary

    Fields inherited from class org.springframework.web.method.HandlerMethod

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance from the given handler and method.
    ServletInvocableHandlerMethod(Object handler, Method method, org.springframework.context.MessageSource messageSource)
    Variant of ServletInvocableHandlerMethod(Object, Method) that also accepts a MessageSource, e.g.
    ServletInvocableHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod)
    Create an instance from a HandlerMethod.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    invokeAndHandle(org.springframework.web.context.request.ServletWebRequest webRequest, org.springframework.web.method.support.ModelAndViewContainer mavContainer, Object... providedArgs)
    Invoke the method and handle the return value through one of the configured HandlerMethodReturnValueHandlers.
    void
    setHandlerMethodReturnValueHandlers(org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite returnValueHandlers)
    Register HandlerMethodReturnValueHandler instances to use to handle return values.

    Methods inherited from class org.springframework.web.method.support.InvocableHandlerMethod

    doInvoke, getMethodArgumentValues, invokeForRequest, invokeSuspendingFunction, setDataBinderFactory, setHandlerMethodArgumentResolvers, setMethodValidator, setParameterNameDiscoverer

    Methods inherited from class org.springframework.web.method.HandlerMethod

    assertTargetBean, createWithResolvedBean, createWithValidateFlags, equals, formatInvokeError, getBean, getBeanType, getContainingClass, getResolvedFromHandlerMethod, getResponseStatus, getResponseStatusReason, getShortLogMessage, hashCode, shouldValidateArguments, shouldValidateReturnValue, toString

    Methods inherited from class org.springframework.core.annotation.AnnotatedMethod

    findProvidedArgument, formatArgumentError, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hasMethodAnnotation, isVoid

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ServletInvocableHandlerMethod

      public ServletInvocableHandlerMethod(Object handler, Method method)
      Creates an instance from the given handler and method.
    • ServletInvocableHandlerMethod

      public ServletInvocableHandlerMethod(Object handler, Method method, @Nullable org.springframework.context.MessageSource messageSource)
      Variant of ServletInvocableHandlerMethod(Object, Method) that also accepts a MessageSource, e.g. to resolve @ResponseStatus messages with.
      Since:
      5.3.10
    • ServletInvocableHandlerMethod

      public ServletInvocableHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod)
      Create an instance from a HandlerMethod.
  • Method Details

    • setHandlerMethodReturnValueHandlers

      public void setHandlerMethodReturnValueHandlers(org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite returnValueHandlers)
      Register HandlerMethodReturnValueHandler instances to use to handle return values.
    • invokeAndHandle

      public void invokeAndHandle(org.springframework.web.context.request.ServletWebRequest webRequest, org.springframework.web.method.support.ModelAndViewContainer mavContainer, Object... providedArgs) throws Exception
      Invoke the method and handle the return value through one of the configured HandlerMethodReturnValueHandlers.
      Parameters:
      webRequest - the current request
      mavContainer - the ModelAndViewContainer for this request
      providedArgs - "given" arguments matched by type (not resolved)
      Throws:
      Exception