Spring Framework

org.springframework.web.bind.annotation.support
Class HandlerMethodInvoker

java.lang.Object
  extended by org.springframework.web.bind.annotation.support.HandlerMethodInvoker

public class HandlerMethodInvoker
extends java.lang.Object

Support class for invoking an annotated handler method. Operates on the introspection results of a HandlerMethodResolver for a specific handler type.

Used by AnnotationMethodHandlerAdapter and AnnotationMethodHandlerAdapter.

Since:
2.5.2
Author:
Juergen Hoeller, Arjen Poutsma
See Also:
invokeHandlerMethod(java.lang.reflect.Method, java.lang.Object, org.springframework.web.context.request.NativeWebRequest, org.springframework.ui.ExtendedModelMap)

Constructor Summary
HandlerMethodInvoker(HandlerMethodResolver methodResolver)
           
HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer)
           
HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer, SessionAttributeStore sessionAttributeStore, ParameterNameDiscoverer parameterNameDiscoverer, WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter[] messageConverters)
           
 
Method Summary
protected  void addReturnValueAsModelAttribute(java.lang.reflect.Method handlerMethod, java.lang.Class handlerType, java.lang.Object returnValue, ExtendedModelMap implicitModel)
           
protected  WebDataBinder createBinder(NativeWebRequest webRequest, java.lang.Object target, java.lang.String objectName)
           
protected  HttpInputMessage createHttpInputMessage(NativeWebRequest webRequest)
          Return a HttpInputMessage for the given NativeWebRequest.
protected  HttpOutputMessage createHttpOutputMessage(NativeWebRequest webRequest)
          Return a HttpOutputMessage for the given NativeWebRequest.
protected  void doBind(WebDataBinder binder, NativeWebRequest webRequest)
           
protected  void initBinder(java.lang.Object handler, java.lang.String attrName, WebDataBinder binder, NativeWebRequest webRequest)
           
 java.lang.Object invokeHandlerMethod(java.lang.reflect.Method handlerMethod, java.lang.Object handler, NativeWebRequest webRequest, ExtendedModelMap implicitModel)
           
protected  boolean isBindingCandidate(java.lang.Object value)
          Determine whether the given value qualifies as a "binding candidate", i.e.
protected  java.lang.String parseDefaultValueAttribute(java.lang.String value)
           
protected  void raiseMissingCookieException(java.lang.String cookieName, java.lang.Class paramType)
           
protected  void raiseMissingHeaderException(java.lang.String headerName, java.lang.Class paramType)
           
protected  void raiseMissingParameterException(java.lang.String paramName, java.lang.Class paramType)
           
protected  void raiseSessionRequiredException(java.lang.String message)
           
protected  java.lang.Object resolveCommonArgument(MethodParameter methodParameter, NativeWebRequest webRequest)
           
protected  java.lang.Object resolveCookieValue(java.lang.String cookieName, java.lang.Class paramType, NativeWebRequest webRequest)
          Resolves the given @CookieValue annotation.
protected  java.lang.Object resolveDefaultValue(java.lang.String value)
           
protected  java.lang.String resolvePathVariable(java.lang.String pathVarName, java.lang.Class paramType, NativeWebRequest webRequest)
          Resolves the given @PathVariable annotation.
protected  java.lang.Object resolveRequestBody(MethodParameter methodParam, NativeWebRequest webRequest, java.lang.Object handler)
          Resolves the given @RequestBody annotation.
protected  java.lang.Object resolveStandardArgument(java.lang.Class<?> parameterType, NativeWebRequest webRequest)
           
 void updateModelAttributes(java.lang.Object handler, java.util.Map<java.lang.String,java.lang.Object> mavModel, ExtendedModelMap implicitModel, NativeWebRequest webRequest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerMethodInvoker

public HandlerMethodInvoker(HandlerMethodResolver methodResolver)

HandlerMethodInvoker

public HandlerMethodInvoker(HandlerMethodResolver methodResolver,
                            WebBindingInitializer bindingInitializer)

HandlerMethodInvoker

public HandlerMethodInvoker(HandlerMethodResolver methodResolver,
                            WebBindingInitializer bindingInitializer,
                            SessionAttributeStore sessionAttributeStore,
                            ParameterNameDiscoverer parameterNameDiscoverer,
                            WebArgumentResolver[] customArgumentResolvers,
                            HttpMessageConverter[] messageConverters)
Method Detail

invokeHandlerMethod

public final java.lang.Object invokeHandlerMethod(java.lang.reflect.Method handlerMethod,
                                                  java.lang.Object handler,
                                                  NativeWebRequest webRequest,
                                                  ExtendedModelMap implicitModel)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

updateModelAttributes

public final void updateModelAttributes(java.lang.Object handler,
                                        java.util.Map<java.lang.String,java.lang.Object> mavModel,
                                        ExtendedModelMap implicitModel,
                                        NativeWebRequest webRequest)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

initBinder

protected void initBinder(java.lang.Object handler,
                          java.lang.String attrName,
                          WebDataBinder binder,
                          NativeWebRequest webRequest)
                   throws java.lang.Exception
Throws:
java.lang.Exception

resolveRequestBody

protected java.lang.Object resolveRequestBody(MethodParameter methodParam,
                                              NativeWebRequest webRequest,
                                              java.lang.Object handler)
                                       throws java.lang.Exception
Resolves the given @RequestBody annotation.

Throws:
java.lang.Exception

resolveCookieValue

protected java.lang.Object resolveCookieValue(java.lang.String cookieName,
                                              java.lang.Class paramType,
                                              NativeWebRequest webRequest)
                                       throws java.lang.Exception
Resolves the given @CookieValue annotation.

Throws an UnsupportedOperationException by default.

Throws:
java.lang.Exception

resolvePathVariable

protected java.lang.String resolvePathVariable(java.lang.String pathVarName,
                                               java.lang.Class paramType,
                                               NativeWebRequest webRequest)
                                        throws java.lang.Exception
Resolves the given @PathVariable annotation.

Throws an UnsupportedOperationException by default.

Throws:
java.lang.Exception

isBindingCandidate

protected boolean isBindingCandidate(java.lang.Object value)
Determine whether the given value qualifies as a "binding candidate", i.e. might potentially be subject to bean-style data binding later on.


raiseMissingParameterException

protected void raiseMissingParameterException(java.lang.String paramName,
                                              java.lang.Class paramType)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

raiseMissingHeaderException

protected void raiseMissingHeaderException(java.lang.String headerName,
                                           java.lang.Class paramType)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

raiseMissingCookieException

protected void raiseMissingCookieException(java.lang.String cookieName,
                                           java.lang.Class paramType)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

raiseSessionRequiredException

protected void raiseSessionRequiredException(java.lang.String message)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

createBinder

protected WebDataBinder createBinder(NativeWebRequest webRequest,
                                     java.lang.Object target,
                                     java.lang.String objectName)
                              throws java.lang.Exception
Throws:
java.lang.Exception

doBind

protected void doBind(WebDataBinder binder,
                      NativeWebRequest webRequest)
               throws java.lang.Exception
Throws:
java.lang.Exception

createHttpInputMessage

protected HttpInputMessage createHttpInputMessage(NativeWebRequest webRequest)
                                           throws java.lang.Exception
Return a HttpInputMessage for the given NativeWebRequest.

Throws an UnsupportedOperation1Exception by default.

Throws:
java.lang.Exception

createHttpOutputMessage

protected HttpOutputMessage createHttpOutputMessage(NativeWebRequest webRequest)
                                             throws java.lang.Exception
Return a HttpOutputMessage for the given NativeWebRequest.

Throws an UnsupportedOperationException by default.

Throws:
java.lang.Exception

parseDefaultValueAttribute

protected java.lang.String parseDefaultValueAttribute(java.lang.String value)

resolveDefaultValue

protected java.lang.Object resolveDefaultValue(java.lang.String value)

resolveCommonArgument

protected java.lang.Object resolveCommonArgument(MethodParameter methodParameter,
                                                 NativeWebRequest webRequest)
                                          throws java.lang.Exception
Throws:
java.lang.Exception

resolveStandardArgument

protected java.lang.Object resolveStandardArgument(java.lang.Class<?> parameterType,
                                                   NativeWebRequest webRequest)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

addReturnValueAsModelAttribute

protected final void addReturnValueAsModelAttribute(java.lang.reflect.Method handlerMethod,
                                                    java.lang.Class handlerType,
                                                    java.lang.Object returnValue,
                                                    ExtendedModelMap implicitModel)

Spring Framework