Package org.springframework.web.servlet.mvc.method

# Class AbstractHandlerMethodAdapter

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter

All Implemented Interfaces:
  `org.springframework.beans.factory.Aware`, `org.springframework.context.ApplicationContextAware`, `org.springframework.core.Ordered`, `org.springframework.web.context.ServletContextAware`, `HandlerAdapter`

Direct Known Subclasses:
  `RequestMappingHandlerAdapter`

public abstract class AbstractHandlerMethodAdapter extends WebContentGenerator implements HandlerAdapter, org.springframework.core.Ordered
Abstract base class for `HandlerAdapter` implementations that support handlers of type `HandlerMethod`.

Since:
  3.1
Author:
  Arjen Poutsma

## Field Summary

### Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator

`HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST`

### Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

`logger`

### Fields inherited from interface org.springframework.core.Ordered

`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

## Constructor Summary

Constructors
Constructor
Description
`AbstractHandlerMethodAdapter()`

## Method Summary

Modifier and Type
Method
Description
`final long`
`getLastModified(HttpServletRequest request, Object handler)`
This implementation expects the handler to be an `HandlerMethod`.
`protected abstract long`
`getLastModifiedInternal(HttpServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)`
Deprecated.
as of 5.3.9 along with `LastModified`.
`int`
`getOrder()`
`final ModelAndView`
`handle(HttpServletRequest request, HttpServletResponse response, Object handler)`
This implementation expects the handler to be an `HandlerMethod`.
`protected abstract ModelAndView`
`handleInternal(HttpServletRequest request, HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod)`
Use the given handler method to handle the request.
`void`
`setOrder(int order)`
Specify the order value for this HandlerAdapter bean.
`final boolean`
`supports(Object handler)`
This implementation expects the handler to be an `HandlerMethod`.
`protected abstract boolean`
`supportsInternal(org.springframework.web.method.HandlerMethod handlerMethod)`
Given a handler method, return whether this adapter can support it.

### Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator

`applyCacheControl, applyCacheSeconds, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeaders`

### Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext`

### Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

`getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AbstractHandlerMethodAdapter

public AbstractHandlerMethodAdapter()

## Method Details

### setOrder

public void setOrder(int order)
Specify the order value for this HandlerAdapter bean.

The default value is `Ordered.LOWEST_PRECEDENCE`, meaning non-ordered.

See Also:
  - `Ordered.getOrder()`

### getOrder

public int getOrder()

Specified by:
  `getOrder` in interface `org.springframework.core.Ordered`

### supports

public final boolean supports(Object handler)
This implementation expects the handler to be an `HandlerMethod`.

Specified by:
  `supports` in interface `HandlerAdapter`
Parameters:
  `handler` - the handler instance to check
Returns:
  whether this adapter can adapt the given handler

### supportsInternal

protected abstract boolean supportsInternal(org.springframework.web.method.HandlerMethod handlerMethod)
Given a handler method, return whether this adapter can support it.

Parameters:
  `handlerMethod` - the handler method to check
Returns:
  whether this adapter can adapt the given method

### handle

@Nullable public final ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
This implementation expects the handler to be an `HandlerMethod`.

Specified by:
  `handle` in interface `HandlerAdapter`
Parameters:
  `request` - current HTTP request
  `response` - current HTTP response
  `handler` - the handler to use. This object must have previously been passed to the `supports` method of this interface, which must have returned `true`.
Returns:
  a ModelAndView object with the name of the view and the required model data, or `null` if the request has been handled directly
Throws:
  `Exception` - in case of errors

### handleInternal

@Nullable protected abstract ModelAndView handleInternal(HttpServletRequest request, HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod) throws Exception
Use the given handler method to handle the request.

Parameters:
  `request` - current HTTP request
  `response` - current HTTP response
  `handlerMethod` - handler method to use. This object must have previously been passed to the `supportsInternal(HandlerMethod)` this interface, which must have returned `true`.
Returns:
  a ModelAndView object with the name of the view and the required model data, or `null` if the request has been handled directly
Throws:
  `Exception` - in case of errors

### getLastModified

public final long getLastModified(HttpServletRequest request, Object handler)
This implementation expects the handler to be an `HandlerMethod`.

Specified by:
  `getLastModified` in interface `HandlerAdapter`
Parameters:
  `request` - current HTTP request
  `handler` - the handler to use
Returns:
  the lastModified value for the given handler

### getLastModifiedInternal

@Deprecated protected abstract long getLastModifiedInternal(HttpServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
Deprecated.
as of 5.3.9 along with `LastModified`.
Same contract as for `HttpServlet.getLastModified(HttpServletRequest)`.

Parameters:
  `request` - current HTTP request
  `handlerMethod` - handler method to use
Returns:
  the lastModified value for the given handler