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:
- Aware, ApplicationContextAware, Ordered, ServletContextAware, HandlerAdapter
- Direct Known Subclasses:
- RequestMappingHandlerAdapter
public abstract class AbstractHandlerMethodAdapter
extends WebContentGenerator
implements HandlerAdapter, Ordered
Abstract base class for 
HandlerAdapter implementations that support
handlers of type HandlerMethod.- Since:
- 3.1
- Author:
- Arjen Poutsma
- 
Field SummaryFields inherited from class WebContentGeneratorHEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POSTFields inherited from class ApplicationObjectSupportloggerFields inherited from interface OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintgetOrder()Get the order value of this object.final @Nullable ModelAndViewhandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) This implementation expects the handler to be anHandlerMethod.protected abstract @Nullable ModelAndViewhandleInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, HandlerMethod handlerMethod) Use the given handler method to handle the request.voidsetOrder(int order) Specify the order value for this HandlerAdapter bean.final booleanThis implementation expects the handler to be anHandlerMethod.protected abstract booleansupportsInternal(HandlerMethod handlerMethod) Given a handler method, return whether this adapter can support it.Methods inherited from class WebContentGeneratorapplyCacheControl, applyCacheSeconds, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeadersMethods inherited from class WebApplicationObjectSupportgetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class ApplicationObjectSupportgetApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
- 
Constructor Details- 
AbstractHandlerMethodAdapterpublic AbstractHandlerMethodAdapter()
 
- 
- 
Method Details- 
setOrderpublic void setOrder(int order) Specify the order value for this HandlerAdapter bean.The default value is Ordered.LOWEST_PRECEDENCE, meaning non-ordered.- See Also:
 
- 
getOrderpublic int getOrder()Description copied from interface:OrderedGet 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-startupvalues).Same order values will result in arbitrary sort positions for the affected objects. 
- 
supportsThis implementation expects the handler to be anHandlerMethod.- Specified by:
- supportsin interface- HandlerAdapter
- Parameters:
- handler- the handler instance to check
- Returns:
- whether this adapter can adapt the given handler
 
- 
supportsInternalGiven 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
 
- 
handlepublic final @Nullable ModelAndView handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) throws Exception This implementation expects the handler to be anHandlerMethod.- Specified by:
- handlein 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- supportsmethod of this interface, which must have returned- true.
- Returns:
- a ModelAndView object with the name of the view and the required
model data, or nullif the request has been handled directly
- Throws:
- Exception- in case of errors
 
- 
handleInternalprotected abstract @Nullable ModelAndView handleInternal(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, 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 nullif the request has been handled directly
- Throws:
- Exception- in case of errors
 
 
-