Top Description Fields Constructors Methods
org.springframework.web.servlet.mvc.method

public abstract Class AbstractHandlerMethodAdapter

extends WebContentGenerator
implements HandlerAdapter, Ordered
Class Inheritance
All Implemented Interfaces
org.springframework.core.Ordered, org.springframework.web.servlet.HandlerAdapter
Known Direct Subclasses
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
Imports
jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.springframework.core.Ordered, org.springframework.lang.Nullable, org.springframework.web.method.HandlerMethod, org.springframework.web.servlet.HandlerAdapter, .ModelAndView, org.springframework.web.servlet.support.WebContentGenerator

Abstract base class for HandlerAdapter implementations that support handlers of type HandlerMethod.
Author
Arjen Poutsma
Since
3.1

Field Summary

Modifier and TypeField and Description
private int
Inherited from org.springframework.web.servlet.support.WebContentGenerator:
HEADER_CACHE_CONTROLMETHOD_GETMETHOD_HEADMETHOD_POST

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final long
getLastModified(HttpServletRequest
current HTTP request
request
,
Object
the handler to use
handler
)

Implements org.springframework.web.servlet.HandlerAdapter.getLastModified.

This implementation expects the handler to be an HandlerMethod.

protected abstract long

Returns:

the lastModified value for the given handler
getLastModifiedInternal
(HttpServletRequest
current HTTP request
request
,
HandlerMethod
handler method to use
handlerMethod
)
Deprecated as of 5.3.9 along with org.springframework.web.servlet.mvc.LastModified.

Same contract as for jakarta.servlet.http.HttpServlet#getLastModified(HttpServletRequest).

public int
getOrder()

Implements org.springframework.core.Ordered.getOrder.

Get the order value of this object.

public final ModelAndView
handle(HttpServletRequest
current HTTP request
request
,
HttpServletResponse
current HTTP response
response
,
Object
the handler to use. This object must have previously been passed to the supports method of this interface, which must have returned true.
handler
)

Implements org.springframework.web.servlet.HandlerAdapter.handle.

This implementation expects the handler to be an HandlerMethod.

protected abstract ModelAndView

Returns:

a ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly
handleInternal
(HttpServletRequest
current HTTP request
request
,
HttpServletResponse
current HTTP response
response
,
HandlerMethod
handler method to use. This object must have previously been passed to the supportsInternal(HandlerMethod) this interface, which must have returned true.
handlerMethod
)

Use the given handler method to handle the request.

public void
setOrder(int order)

Specify the order value for this HandlerAdapter bean.

public final boolean

Returns:

whether this adapter can adapt the given handler
supports
(Object
the handler instance to check
handler
)

Implements org.springframework.web.servlet.HandlerAdapter.supports.

This implementation expects the handler to be an HandlerMethod.

protected abstract boolean

Returns:

whether this adapter can adapt the given method
supportsInternal
(HandlerMethod
the handler method to check
handlerMethod
)

Given a handler method, return whether this adapter can support it.

Inherited from org.springframework.web.servlet.support.WebContentGenerator:
applyCacheControlapplyCacheSecondsapplyCacheSecondscacheForSecondscacheForSecondscheckAndPreparecheckRequestgetAllowHeadergetCacheControlgetCacheSecondsgetSupportedMethodsgetVaryByRequestHeadersisAlwaysMustRevalidateisRequireSessionisUseCacheControlHeaderisUseCacheControlNoStoreisUseExpiresHeaderprepareResponsepreventCachingsetAlwaysMustRevalidatesetCacheControlsetCacheSecondssetRequireSessionsetSupportedMethodssetUseCacheControlHeadersetUseCacheControlNoStoresetUseExpiresHeadersetVaryByRequestHeaders

Field Detail

orderback to summary
private int order

Constructor Detail

AbstractHandlerMethodAdapterback to summary
public AbstractHandlerMethodAdapter()

Method Detail

getLastModifiedback to summary
public final long getLastModified(HttpServletRequest request, Object handler)

Implements org.springframework.web.servlet.HandlerAdapter.getLastModified.

This implementation expects the handler to be an HandlerMethod.

Parameters
request:HttpServletRequest

Doc from org.springframework.web.servlet.HandlerAdapter.getLastModified.

current HTTP request

handler:Object

Doc from org.springframework.web.servlet.HandlerAdapter.getLastModified.

the handler to use

Returns:long

Doc from org.springframework.web.servlet.HandlerAdapter.getLastModified.

the lastModified value for the given handler

Annotations
@Override
@SuppressWarnings:deprecation
getLastModifiedInternalback to summary
protected abstract long getLastModifiedInternal(HttpServletRequest request, HandlerMethod handlerMethod)

Deprecated

as of 5.3.9 along with org.springframework.web.servlet.mvc.LastModified.

Same contract as for jakarta.servlet.http.HttpServlet#getLastModified(HttpServletRequest).

Parameters
request:HttpServletRequest

current HTTP request

handlerMethod:HandlerMethod

handler method to use

Returns:long

the lastModified value for the given handler

Annotations
@Deprecated
getOrderback to summary
public int getOrder()

Implements org.springframework.core.Ordered.getOrder.

Doc from org.springframework.core.Ordered.getOrder.

Get the order value of this object.

Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet load-on-startup values).

Same order values will result in arbitrary sort positions for the affected objects.

Returns:int

the order value

Annotations
@Override
handleback to summary
public final ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception

Implements org.springframework.web.servlet.HandlerAdapter.handle.

This implementation expects the handler to be an HandlerMethod.

Parameters
request:HttpServletRequest

Doc from org.springframework.web.servlet.HandlerAdapter.handle.

current HTTP request

response:HttpServletResponse

Doc from org.springframework.web.servlet.HandlerAdapter.handle.

current HTTP response

handler:Object

Doc from org.springframework.web.servlet.HandlerAdapter.handle.

the handler to use. This object must have previously been passed to the supports method of this interface, which must have returned true.

Returns:ModelAndView

Doc from org.springframework.web.servlet.HandlerAdapter.handle.

a ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly

Annotations
@Override
@Nullable
Exceptions
Exception:

Doc from org.springframework.web.servlet.HandlerAdapter.handle.

in case of errors

handleInternalback to summary
protected abstract ModelAndView handleInternal(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) throws Exception

Use the given handler method to handle the request.

Parameters
request:HttpServletRequest

current HTTP request

response:HttpServletResponse

current HTTP response

handlerMethod:HandlerMethod

handler method to use. This object must have previously been passed to the supportsInternal(HandlerMethod) this interface, which must have returned true.

Returns:ModelAndView

a ModelAndView object with the name of the view and the required model data, or null if the request has been handled directly

Annotations
@Nullable
Exceptions
Exception:
in case of errors
setOrderback to summary
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
org.springframework.core.Ordered#getOrder()
supportsback to summary
public final boolean supports(Object handler)

Implements org.springframework.web.servlet.HandlerAdapter.supports.

This implementation expects the handler to be an HandlerMethod.

Parameters
handler:Object

the handler instance to check

Returns:boolean

whether this adapter can adapt the given handler

Annotations
@Override
supportsInternalback to summary
protected abstract boolean supportsInternal(HandlerMethod handlerMethod)

Given a handler method, return whether this adapter can support it.

Parameters
handlerMethod:HandlerMethod

the handler method to check

Returns:boolean

whether this adapter can adapt the given method