org.springframework.web.bind.annotation.support

## Class HandlerMethodInvoker

- java.lang.Object
- - org.springframework.web.bind.annotation.support.HandlerMethodInvoker

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

Constructors
Constructor and Description
`HandlerMethodInvoker(HandlerMethodResolver methodResolver)`
`HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer)`
`HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer, SessionAttributeStore sessionAttributeStore, ParameterNameDiscoverer parameterNameDiscoverer, WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter[] messageConverters)`

### Method Summary

Methods
`protected void` `addReturnValueAsModelAttribute(Method handlerMethod, Class handlerType, Object returnValue, ExtendedModelMap implicitModel)`
`protected WebDataBinder` `createBinder(NativeWebRequest webRequest, Object target, 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(Object handler, String attrName, WebDataBinder binder, NativeWebRequest webRequest)`
`Object` `invokeHandlerMethod(Method handlerMethod, Object handler, NativeWebRequest webRequest, ExtendedModelMap implicitModel)`
`protected boolean` `isBindingCandidate(Object value)` Determine whether the given value qualifies as a "binding candidate", i.e.
`protected String` `parseDefaultValueAttribute(String value)`
`protected void` `raiseMissingCookieException(String cookieName, Class paramType)`
`protected void` `raiseMissingHeaderException(String headerName, Class paramType)`
`protected void` `raiseMissingParameterException(String paramName, Class paramType)`
`protected void` `raiseSessionRequiredException(String message)`
`protected Object` `resolveCommonArgument(MethodParameter methodParameter, NativeWebRequest webRequest)`
`protected Object` `resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest)` Resolves the given `@CookieValue` annotation.
`protected Object` `resolveDefaultValue(String value)`
`protected String` `resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest)` Resolves the given `@PathVariable` annotation.
`protected Object` `resolveRequestBody(MethodParameter methodParam, NativeWebRequest webRequest, Object handler)` Resolves the given `@RequestBody` annotation.
`protected Object` `resolveStandardArgument(Class<?> parameterType, NativeWebRequest webRequest)`
`void` `updateModelAttributes(Object handler, Map<String,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 Object invokeHandlerMethod(Method handlerMethod,
                             Object handler,
                             NativeWebRequest webRequest,
                             ExtendedModelMap implicitModel)
                                     throws Exception

Throws:
  `Exception`

#### updateModelAttributes

    public final void updateModelAttributes(Object handler,
                             Map<String,Object> mavModel,
                             ExtendedModelMap implicitModel,
                             NativeWebRequest webRequest)
                                     throws Exception

Throws:
  `Exception`

#### initBinder

    protected void initBinder(Object handler,
                  String attrName,
                  WebDataBinder binder,
                  NativeWebRequest webRequest)
                       throws Exception

Throws:
  `Exception`

#### resolveRequestBody

    protected Object resolveRequestBody(MethodParameter methodParam,
                            NativeWebRequest webRequest,
                            Object handler)
                                 throws Exception

Resolves the given `@RequestBody` annotation.

Throws:
  `Exception`

#### resolveCookieValue

    protected Object resolveCookieValue(String cookieName,
                            Class paramType,
                            NativeWebRequest webRequest)
                                 throws Exception

Resolves the given `@CookieValue` annotation.

Throws an UnsupportedOperationException by default.

Throws:
  `Exception`

#### resolvePathVariable

    protected String resolvePathVariable(String pathVarName,
                             Class paramType,
                             NativeWebRequest webRequest)
                                  throws Exception

Resolves the given `@PathVariable` annotation.

Throws an UnsupportedOperationException by default.

Throws:
  `Exception`

#### isBindingCandidate

    protected boolean isBindingCandidate(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(String paramName,
                                      Class paramType)
                                           throws Exception

Throws:
  `Exception`

#### raiseMissingHeaderException

    protected void raiseMissingHeaderException(String headerName,
                                   Class paramType)
                                        throws Exception

Throws:
  `Exception`

#### raiseMissingCookieException

    protected void raiseMissingCookieException(String cookieName,
                                   Class paramType)
                                        throws Exception

Throws:
  `Exception`

#### raiseSessionRequiredException

    protected void raiseSessionRequiredException(String message)
                                          throws Exception

Throws:
  `Exception`

#### createBinder

    protected WebDataBinder createBinder(NativeWebRequest webRequest,
                             Object target,
                             String objectName)
                                  throws Exception

Throws:
  `Exception`

#### doBind

    protected void doBind(WebDataBinder binder,
              NativeWebRequest webRequest)
                   throws Exception

Throws:
  `Exception`

#### createHttpInputMessage

    protected HttpInputMessage createHttpInputMessage(NativeWebRequest webRequest)
                                               throws Exception

Return a `HttpInputMessage` for the given `NativeWebRequest`.

Throws an UnsupportedOperation1Exception by default.

Throws:
  `Exception`

#### createHttpOutputMessage

    protected HttpOutputMessage createHttpOutputMessage(NativeWebRequest webRequest)
                                                 throws Exception

Return a `HttpOutputMessage` for the given `NativeWebRequest`.

Throws an UnsupportedOperationException by default.

Throws:
  `Exception`

#### parseDefaultValueAttribute

    protected String parseDefaultValueAttribute(String value)

#### resolveDefaultValue

    protected Object resolveDefaultValue(String value)

#### resolveCommonArgument

    protected Object resolveCommonArgument(MethodParameter methodParameter,
                               NativeWebRequest webRequest)
                                    throws Exception

Throws:
  `Exception`

#### resolveStandardArgument

    protected Object resolveStandardArgument(Class<?> parameterType,
                                 NativeWebRequest webRequest)
                                      throws Exception

Throws:
  `Exception`

#### addReturnValueAsModelAttribute

    protected final void addReturnValueAsModelAttribute(Method handlerMethod,
                                      Class handlerType,
                                      Object returnValue,
                                      ExtendedModelMap implicitModel)