public abstract class AbstractMethodHandlerAdapter
extends org.springframework.web.servlet.support.WebContentGenerator
implements org.springframework.web.servlet.HandlerAdapter, org.springframework.beans.factory.BeanFactoryAware
Modifier and Type | Field and Description |
---|---|
protected org.springframework.web.servlet.mvc.multiaction.MethodNameResolver |
methodNameResolver |
static String |
PAGE_NOT_FOUND_LOG_CATEGORY
Log category to use when no mapped handler is found for a request.
|
protected static Logger |
pageNotFoundLogger
Additional logger to use when no mapped handler is found for a request.
|
protected org.springframework.util.PathMatcher |
pathMatcher |
protected org.springframework.web.util.UrlPathHelper |
urlPathHelper |
Constructor and Description |
---|
AbstractMethodHandlerAdapter() |
Modifier and Type | Method and Description |
---|---|
org.springframework.web.bind.ServletRequestDataBinder |
createBinder(javax.servlet.http.HttpServletRequest request,
Object target,
String objectName) |
protected void |
doPreMethodInvokeHandler(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Method handlerMethod,
Object handler)
方法调用之前执行相关处理动作。比如防重复提交,CSRF,其他annotation处理等
|
org.springframework.beans.factory.config.ConfigurableBeanFactory |
getBeanFactory() |
org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[] |
getCustomModelAndViewResolvers() |
org.springframework.beans.factory.config.BeanExpressionContext |
getExpressionContext() |
HttpMessageConverterComposite |
getHttpMessageConverterComposite() |
long |
getLastModified(javax.servlet.http.HttpServletRequest request,
Object handler) |
MethodInvokePreHandlerComposite |
getMethodInvokePreHandlerComposite() |
protected ServletHandlerMethodResolver |
getMethodResolver(Object handler) |
org.springframework.util.PathMatcher |
getPathMatcher() |
org.springframework.web.util.UrlPathHelper |
getUrlPathHelper() |
org.springframework.web.servlet.ModelAndView |
handle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler) |
protected org.springframework.web.servlet.ModelAndView |
handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle the case where no request handler method was found.
|
boolean |
isConventionHandler(Object handler) |
void |
setAlwaysUseFullPath(boolean alwaysUseFullPath)
Set if URL lookup should always use the full path within the current
servlet context.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setConventionHelper(ConventionHelper conventionHelper) |
void |
setCustomArgumentResolver(org.springframework.web.bind.support.WebArgumentResolver argumentResolver)
Set a custom ArgumentResolvers to use for special method parameter types.
|
void |
setCustomArgumentResolvers(org.springframework.web.bind.support.WebArgumentResolver[] argumentResolvers)
Set one or more custom ArgumentResolvers to use for special method
parameter types.
|
void |
setCustomModelAndViewResolver(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver customModelAndViewResolver) |
void |
setCustomModelAndViewResolvers(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[] customModelAndViewResolvers) |
void |
setHttpMessageConverterComposite(HttpMessageConverterComposite httpMessageConverterComposite) |
void |
setMethodInvokePreHandlerComposite(MethodInvokePreHandlerComposite methodInvokePreHandlerComposite) |
void |
setMethodNameResolver(org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver)
Set the MethodNameResolver to use for resolving default handler methods
(carrying an empty
@RequestMapping annotation). |
void |
setParameterNameDiscoverer(org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer)
Set the ParameterNameDiscoverer to use for resolving method parameter
names if needed (e.g.
|
void |
setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
Set the PathMatcher implementation to use for matching URL paths against
registered URL patterns.
|
void |
setSessionAttributeStore(org.springframework.web.bind.support.SessionAttributeStore sessionAttributeStore)
Specify the strategy to store session attributes with.
|
void |
setSynchronizeOnSession(boolean synchronizeOnSession)
Set if controller execution should be synchronized on the session, to
serialize parallel invocations from the same client.
|
void |
setUrlDecode(boolean urlDecode)
Set if context path and request URI should be URL-decoded.
|
void |
setUrlPathHelper(org.springframework.web.util.UrlPathHelper urlPathHelper)
Set the UrlPathHelper to use for resolution of lookup paths.
|
void |
setWebBindingInitializer(org.springframework.web.bind.support.WebBindingInitializer webBindingInitializer)
Specify a WebBindingInitializer which will apply pre-configured
configuration to every DataBinder that this controller uses.
|
abstract boolean |
supports(Object handler) |
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
public static final String PAGE_NOT_FOUND_LOG_CATEGORY
pageNotFoundLogger
,
Constant Field Valuesprotected static final Logger pageNotFoundLogger
PAGE_NOT_FOUND_LOG_CATEGORY
protected org.springframework.web.util.UrlPathHelper urlPathHelper
protected org.springframework.util.PathMatcher pathMatcher
protected org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver
public void setConventionHelper(ConventionHelper conventionHelper)
public org.springframework.beans.factory.config.ConfigurableBeanFactory getBeanFactory()
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
public org.springframework.beans.factory.config.BeanExpressionContext getExpressionContext()
public org.springframework.web.util.UrlPathHelper getUrlPathHelper()
public void setUrlPathHelper(org.springframework.web.util.UrlPathHelper urlPathHelper)
public org.springframework.util.PathMatcher getPathMatcher()
public void setPathMatcher(org.springframework.util.PathMatcher pathMatcher)
AntPathMatcher
public MethodInvokePreHandlerComposite getMethodInvokePreHandlerComposite()
public void setMethodInvokePreHandlerComposite(MethodInvokePreHandlerComposite methodInvokePreHandlerComposite)
public HttpMessageConverterComposite getHttpMessageConverterComposite()
public void setHttpMessageConverterComposite(HttpMessageConverterComposite httpMessageConverterComposite)
public void setCustomModelAndViewResolver(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver customModelAndViewResolver)
public org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[] getCustomModelAndViewResolvers()
public void setCustomModelAndViewResolvers(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[] customModelAndViewResolvers)
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)
UrlPathHelper.setAlwaysUseFullPath(boolean)
public void setUrlDecode(boolean urlDecode)
UrlPathHelper.setUrlDecode(boolean)
public void setMethodNameResolver(org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver)
@RequestMapping
annotation).
Will only kick in when the handler method cannot be resolved uniquely
through the annotation metadata already.public void setWebBindingInitializer(org.springframework.web.bind.support.WebBindingInitializer webBindingInitializer)
public void setSessionAttributeStore(org.springframework.web.bind.support.SessionAttributeStore sessionAttributeStore)
DefaultSessionAttributeStore
, storing session attributes in the HttpSession, using the same attribute
name as in the model.public void setSynchronizeOnSession(boolean synchronizeOnSession)
SESSION_MUTEX_ATTRIBUTE
constant. It serves as a safe
reference to synchronize on for locking on the current session.
In many cases, the HttpSession reference itself is a safe mutex as well,
since it will always be the same object reference for the same active
logical session. However, this is not guaranteed across different servlet
containers; the only 100% safe way is a session mutex.HttpSessionMutexListener
,
WebUtils.getSessionMutex(javax.servlet.http.HttpSession)
public void setParameterNameDiscoverer(org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer)
LocalVariableTableParameterNameDiscoverer
.public void setCustomArgumentResolver(org.springframework.web.bind.support.WebArgumentResolver argumentResolver)
public void setCustomArgumentResolvers(org.springframework.web.bind.support.WebArgumentResolver[] argumentResolvers)
public long getLastModified(javax.servlet.http.HttpServletRequest request, Object handler)
getLastModified
in interface org.springframework.web.servlet.HandlerAdapter
public boolean isConventionHandler(Object handler)
public org.springframework.web.servlet.ModelAndView handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) throws Exception
handle
in interface org.springframework.web.servlet.HandlerAdapter
Exception
protected void doPreMethodInvokeHandler(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Method handlerMethod, Object handler)
request
- response
- handlerMethod
- handler
- protected org.springframework.web.servlet.ModelAndView handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
ex
- the NoSuchRequestHandlingMethodException to be handledrequest
- current HTTP requestresponse
- current HTTP responsenull
if handled
directlyException
- an Exception that should be thrown as result of the servlet
requestprotected ServletHandlerMethodResolver getMethodResolver(Object handler)
public org.springframework.web.bind.ServletRequestDataBinder createBinder(javax.servlet.http.HttpServletRequest request, Object target, String objectName) throws Exception
Exception
public abstract boolean supports(Object handler)
supports
in interface org.springframework.web.servlet.HandlerAdapter
Copyright © 2006–2018 TinyGroup. All rights reserved.