public abstract class AbstractHandlerMethodAdapter extends WebContentGenerator implements HandlerAdapter, org.springframework.core.Ordered
HandlerAdapter
implementations that support
handlers of type HandlerMethod
.METHOD_GET, METHOD_HEAD, METHOD_POST
Constructor and Description |
---|
AbstractHandlerMethodAdapter() |
Modifier and Type | Method and Description |
---|---|
long |
getLastModified(HttpServletRequest request,
Object handler)
Same contract as for HttpServlet's
getLastModified method. |
protected abstract long |
getLastModifiedInternal(HttpServletRequest request,
org.springframework.web.method.HandlerMethod handlerMethod)
Same contract as for
HttpServlet.getLastModified(HttpServletRequest) . |
int |
getOrder() |
ModelAndView |
handle(HttpServletRequest request,
HttpServletResponse response,
Object handler)
Use the given handler to handle this request.
|
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.
|
boolean |
supports(Object handler)
Given a handler instance, return whether or not this
HandlerAdapter
can support it. |
protected abstract boolean |
supportsInternal(org.springframework.web.method.HandlerMethod handlerMethod)
Given a handler method, return whether or not this adapter can support it.
|
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
public void setOrder(int order)
Default value is Integer.MAX_VALUE
, meaning that it's non-ordered.
Ordered.getOrder()
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
public final boolean supports(Object handler)
HandlerAdapter
can support it. Typical HandlerAdapters will base the decision on the handler
type. HandlerAdapters will usually only support one handler type each.
A typical implementation:
return (handler instanceof MyHandler);
This implementation expects the handler to be an HandlerMethod
.
supports
in interface HandlerAdapter
handler
- the handler instance to checkprotected abstract boolean supportsInternal(org.springframework.web.method.HandlerMethod handlerMethod)
handlerMethod
- the handler method to checkpublic final ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
This implementation expects the handler to be an 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 directlyException
- in case of errorsprotected abstract ModelAndView handleInternal(HttpServletRequest request, HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod) throws 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 directlyException
- in case of errorspublic final long getLastModified(HttpServletRequest request, Object handler)
getLastModified
method.
Can simply return -1 if there's no support in the handler class. This implementation expects the handler to be an HandlerMethod
.
getLastModified
in interface HandlerAdapter
request
- current HTTP requesthandler
- handler to useHttpServlet.getLastModified(javax.servlet.http.HttpServletRequest)
,
LastModified.getLastModified(javax.servlet.http.HttpServletRequest)
protected abstract long getLastModifiedInternal(HttpServletRequest request, org.springframework.web.method.HandlerMethod handlerMethod)
HttpServlet.getLastModified(HttpServletRequest)
.request
- current HTTP requesthandlerMethod
- handler method to use