public abstract class AbstractHandlerMethodAdapter extends WebContentGenerator implements HandlerAdapter, Ordered
HandlerAdapter
implementations that support
handlers of type HandlerMethod
.Modifier and Type | Field and Description |
---|---|
private int |
order |
HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST
logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AbstractHandlerMethodAdapter() |
Modifier and Type | Method and Description |
---|---|
long |
getLastModified(HttpServletRequest request,
java.lang.Object handler)
This implementation expects the handler to be an
HandlerMethod . |
protected abstract long |
getLastModifiedInternal(HttpServletRequest request,
HandlerMethod handlerMethod)
Same contract as for
javax.servlet.http.HttpServlet#getLastModified(HttpServletRequest) . |
int |
getOrder()
Get the order value of this object.
|
ModelAndView |
handle(HttpServletRequest request,
HttpServletResponse response,
java.lang.Object handler)
This implementation expects the handler to be an
HandlerMethod . |
protected abstract ModelAndView |
handleInternal(HttpServletRequest request,
HttpServletResponse response,
HandlerMethod handlerMethod)
Use the given handler method to handle the request.
|
void |
setOrder(int order)
Specify the order value for this HandlerAdapter bean.
|
boolean |
supports(java.lang.Object handler)
This implementation expects the handler to be an
HandlerMethod . |
protected abstract boolean |
supportsInternal(HandlerMethod handlerMethod)
Given a handler method, return whether or not this adapter can support it.
|
applyCacheControl, applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, prepareResponse, preventCaching, setAlwaysMustRevalidate, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader, setVaryByRequestHeaders
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
public void setOrder(int order)
Default value is Integer.MAX_VALUE
, meaning that it's non-ordered.
Ordered.getOrder()
public int getOrder()
Ordered
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.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE
public final boolean supports(java.lang.Object handler)
HandlerMethod
.supports
in interface HandlerAdapter
handler
- the handler instance to checkprotected abstract boolean supportsInternal(HandlerMethod handlerMethod)
handlerMethod
- the handler method to checkpublic final ModelAndView handle(HttpServletRequest request, HttpServletResponse response, java.lang.Object handler) throws java.lang.Exception
HandlerMethod
.handle
in interface HandlerAdapter
request
- current HTTP requestresponse
- current HTTP responsehandler
- handler to use. This object must have previously been passed
to the supports
method of this interface, which must have
returned true
.null
if the request has been handled directlyjava.lang.Exception
- in case of errorsprotected abstract ModelAndView handleInternal(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) throws java.lang.Exception
request
- current HTTP requestresponse
- current HTTP responsehandlerMethod
- handler method to use. This object must have previously been passed to the
supportsInternal(HandlerMethod)
this interface, which must have returned true
.null
if the request has been handled directlyjava.lang.Exception
- in case of errorspublic final long getLastModified(HttpServletRequest request, java.lang.Object handler)
HandlerMethod
.getLastModified
in interface HandlerAdapter
request
- current HTTP requesthandler
- handler to usejavax.servlet.http.HttpServlet#getLastModified
,
LastModified.getLastModified(HttpServletRequest)
protected abstract long getLastModifiedInternal(HttpServletRequest request, HandlerMethod handlerMethod)
javax.servlet.http.HttpServlet#getLastModified(HttpServletRequest)
.request
- current HTTP requesthandlerMethod
- handler method to use