类 RequestMappingHandlerAdapter
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.beans.factory.BeanFactoryAware,cn.taketoday.beans.factory.InitializingBean,cn.taketoday.context.ApplicationContextAware,cn.taketoday.core.Ordered,HandlerAdapter
- 从以下版本开始:
- 4.0 2022/4/8 22:46
- 作者:
- Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze, Harry Yang
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private cn.taketoday.beans.factory.config.ConfigurableBeanFactoryprivate intprivate ControllerMethodResolverprivate ModelHandlerprivate cn.taketoday.core.ParameterNameDiscovererprivate RedirectModelManagerprivate ParameterResolvingRegistryprivate SessionAttributeStoreprivate SessionManagerprivate booleanprivate WebBindingInitializer从类继承的字段 cn.taketoday.web.WebContentGenerator
HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST从类继承的字段 cn.taketoday.context.support.ApplicationObjectSupport
applicationContext, log, messageSourceAccessor从接口继承的字段 cn.taketoday.web.HandlerAdapter
HANDLER_ADAPTER_BEAN_NAME, NONE_RETURN_VALUE从接口继承的字段 cn.taketoday.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidprotected cn.taketoday.beans.factory.config.ConfigurableBeanFactoryReturn the owning factory of this bean instance, ornullif none.private WebSessiongetSession(RequestContext request) Return the configured WebBindingInitializer, ornullif none.protected ObjecthandleInternal(RequestContext request, HandlerMethod handlerMethod) Use the given handler method to handle the request.protected ObjectinvokeHandlerMethod(RequestContext request, HandlerMethod handlerMethod) Invoke theRequestMappinghandler method preparing aModelAndViewif view resolution is required.voidsetBeanFactory(cn.taketoday.beans.factory.BeanFactory beanFactory) AConfigurableBeanFactoryis expected for resolving expressions in method argument default values.voidsetCacheSecondsForSessionAttributeHandlers(int cacheSecondsForSessionAttributeHandlers) Cache content produced by@SessionAttributesannotated handlers for the given number of seconds.voidsetParameterNameDiscoverer(cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer) Set the ParameterNameDiscoverer to use for resolving method parameter names if needed (e.g. for default attribute names).voidsetRedirectModelManager(RedirectModelManager redirectModelManager) voidsetResolvingRegistry(ParameterResolvingRegistry resolvingRegistry) voidsetSessionAttributeStore(SessionAttributeStore sessionAttributeStore) Specify the strategy to store session attributes with.voidsetSessionManager(SessionManager sessionManager) voidsetSynchronizeOnSession(boolean synchronizeOnSession) Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client.voidsetWebBindingInitializer(WebBindingInitializer webBindingInitializer) Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance.protected booleansupportsInternal(HandlerMethod handlerMethod) Always returntruesince any method argument and return value type will be processed in some way.从类继承的方法 cn.taketoday.web.handler.method.AbstractHandlerMethodAdapter
getOrder, handle, setOrder, supports从类继承的方法 cn.taketoday.web.WebContentGenerator
applyCacheControl, applyCacheSeconds, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeaders从类继承的方法 cn.taketoday.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContext, unwrapContext, unwrapFactory
-
字段详细资料
-
resolvingRegistry
-
webBindingInitializer
-
cacheSecondsForSessionAttributeHandlers
private int cacheSecondsForSessionAttributeHandlers -
synchronizeOnSession
private boolean synchronizeOnSession -
sessionAttributeStore
-
parameterNameDiscoverer
private cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer -
beanFactory
@Nullable private cn.taketoday.beans.factory.config.ConfigurableBeanFactory beanFactory -
sessionManager
-
redirectModelManager
-
methodResolver
-
modelHandler
-
-
构造器详细资料
-
RequestMappingHandlerAdapter
public RequestMappingHandlerAdapter()
-
-
方法详细资料
-
setRedirectModelManager
-
setResolvingRegistry
-
setWebBindingInitializer
Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance. -
getWebBindingInitializer
Return the configured WebBindingInitializer, ornullif none. -
setSessionAttributeStore
Specify the strategy to store session attributes with. The default isDefaultSessionAttributeStore, storing session attributes in the WebSession with the same attribute name as in the model. -
setCacheSecondsForSessionAttributeHandlers
public void setCacheSecondsForSessionAttributeHandlers(int cacheSecondsForSessionAttributeHandlers) Cache content produced by@SessionAttributesannotated handlers for the given number of seconds.Possible values are:
- -1: no generation of cache-related headers
- 0 (default value): "Cache-Control: no-store" will prevent caching
- 1 or higher: "Cache-Control: max-age=seconds" will ask to cache content; not advised when dealing with session attributes
In contrast to the "cacheSeconds" property which will apply to all general handlers (but not to
@SessionAttributesannotated handlers), this setting will apply to@SessionAttributeshandlers only. -
setSynchronizeOnSession
public void setSynchronizeOnSession(boolean synchronizeOnSession) Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client.More specifically, the execution of the
handleRequestInternalmethod will get synchronized if this flag is "true". The best available session mutex will be used for the synchronization; ideally, this will be a mutex exposed by HttpSessionMutexListener.The session mutex is guaranteed to be the same object during the entire lifetime of the session, available under the key defined by the
SESSION_MUTEX_ATTRIBUTEconstant. 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.
-
setParameterNameDiscoverer
public void setParameterNameDiscoverer(cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer) Set the ParameterNameDiscoverer to use for resolving method parameter names if needed (e.g. for default attribute names).Default is a
DefaultParameterNameDiscoverer. -
setBeanFactory
public void setBeanFactory(cn.taketoday.beans.factory.BeanFactory beanFactory) AConfigurableBeanFactoryis expected for resolving expressions in method argument default values.- 指定者:
setBeanFactory在接口中cn.taketoday.beans.factory.BeanFactoryAware
-
getBeanFactory
@Nullable protected cn.taketoday.beans.factory.config.ConfigurableBeanFactory getBeanFactory()Return the owning factory of this bean instance, ornullif none. -
setSessionManager
-
afterPropertiesSet
public void afterPropertiesSet()- 指定者:
afterPropertiesSet在接口中cn.taketoday.beans.factory.InitializingBean
-
supportsInternal
Always returntruesince any method argument and return value type will be processed in some way. A method argument not recognized by any ParameterResolvingStrategy is interpreted as a request parameter if it is a simple type, or as a model attribute otherwise. A return value not recognized by any HandlerMethodReturnValueHandler will be interpreted as a model attribute.- 指定者:
supportsInternal在类中AbstractHandlerMethodAdapter- 参数:
handlerMethod- the handler method to check- 返回:
- whether this adapter can adapt the given method
-
handleInternal
protected Object handleInternal(RequestContext request, HandlerMethod handlerMethod) throws Throwable 从类复制的说明:AbstractHandlerMethodAdapterUse the given handler method to handle the request.- 指定者:
handleInternal在类中AbstractHandlerMethodAdapter- 参数:
request- current HTTP requesthandlerMethod- handler method to use. This object must have previously been passed to theAbstractHandlerMethodAdapter.supportsInternal(HandlerMethod)this interface, which must have returnedtrue.- 返回:
- an object to render, or
null - 抛出:
Exception- in case of errorsThrowable
-
getSession
-
invokeHandlerMethod
@Nullable protected Object invokeHandlerMethod(RequestContext request, HandlerMethod handlerMethod) throws Throwable Invoke theRequestMappinghandler method preparing aModelAndViewif view resolution is required.
-