Spring Framework

org.springframework.web.servlet.mvc.method.annotation
Class ServletInvocableHandlerMethod

java.lang.Object
  extended by org.springframework.web.method.HandlerMethod
      extended by org.springframework.web.method.support.InvocableHandlerMethod
          extended by org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod

public class ServletInvocableHandlerMethod
extends 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

Field Summary
 
Fields inherited from class org.springframework.web.method.HandlerMethod
logger
 
Constructor Summary
ServletInvocableHandlerMethod(java.lang.Object handler, java.lang.reflect.Method method)
          Creates a ServletInvocableHandlerMethod instance with the given bean and method.
 
Method Summary
 void invokeAndHandle(ServletWebRequest webRequest, ModelAndViewContainer mavContainer, java.lang.Object... providedArgs)
          Invokes the method and handles the return value through a registered HandlerMethodReturnValueHandler.
 void setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
          Register HandlerMethodReturnValueHandler instances to use to handle return values.
 
Methods inherited from class org.springframework.web.method.support.InvocableHandlerMethod
getDetailedErrorMessage, invokeForRequest, setDataBinderFactory, setHandlerMethodArgumentResolvers, setParameterNameDiscoverer
 
Methods inherited from class org.springframework.web.method.HandlerMethod
createWithResolvedBean, equals, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hashCode, isVoid, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServletInvocableHandlerMethod

public ServletInvocableHandlerMethod(java.lang.Object handler,
                                     java.lang.reflect.Method method)
Creates a ServletInvocableHandlerMethod instance with the given bean and method.

Parameters:
handler - the object handler
method - the method
Method Detail

setHandlerMethodReturnValueHandlers

public void setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
Register HandlerMethodReturnValueHandler instances to use to handle return values.


invokeAndHandle

public final void invokeAndHandle(ServletWebRequest webRequest,
                                  ModelAndViewContainer mavContainer,
                                  java.lang.Object... providedArgs)
                           throws java.lang.Exception
Invokes the method and handles the return value through a registered HandlerMethodReturnValueHandler.

Parameters:
webRequest - the current request
mavContainer - the ModelAndViewContainer for this request
providedArgs - "given" arguments matched by type, not resolved
Throws:
java.lang.Exception

Spring Framework