类 RequestMappingHandlerAdapter

java.lang.Object
cn.taketoday.context.support.ApplicationObjectSupport
所有已实现的接口:
cn.taketoday.beans.factory.Aware, cn.taketoday.beans.factory.BeanFactoryAware, cn.taketoday.beans.factory.InitializingBean, cn.taketoday.context.ApplicationContextAware, cn.taketoday.core.Ordered, HandlerAdapter

public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter implements cn.taketoday.beans.factory.BeanFactoryAware, cn.taketoday.beans.factory.InitializingBean
Extension of AbstractHandlerMethodAdapter that supports @RequestMapping annotated HandlerMethods.
从以下版本开始:
4.0 2022/4/8 22:46
作者:
Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze, Harry Yang
另请参阅:
  • 字段详细资料

    • resolvingRegistry

      @Nullable private ParameterResolvingRegistry resolvingRegistry
    • webBindingInitializer

      @Nullable private WebBindingInitializer webBindingInitializer
    • cacheSecondsForSessionAttributeHandlers

      private int cacheSecondsForSessionAttributeHandlers
    • synchronizeOnSession

      private boolean synchronizeOnSession
    • sessionAttributeStore

      private SessionAttributeStore sessionAttributeStore
    • parameterNameDiscoverer

      private cn.taketoday.core.ParameterNameDiscoverer parameterNameDiscoverer
    • beanFactory

      @Nullable private cn.taketoday.beans.factory.config.ConfigurableBeanFactory beanFactory
    • sessionManager

      @Nullable private SessionManager sessionManager
    • redirectModelManager

      @Nullable private RedirectModelManager redirectModelManager
    • methodResolver

      private ControllerMethodResolver methodResolver
    • modelHandler

      private ModelHandler modelHandler
  • 构造器详细资料

    • RequestMappingHandlerAdapter

      public RequestMappingHandlerAdapter()
  • 方法详细资料

    • setRedirectModelManager

      public void setRedirectModelManager(@Nullable RedirectModelManager redirectModelManager)
    • setResolvingRegistry

      public void setResolvingRegistry(@Nullable ParameterResolvingRegistry resolvingRegistry)
    • setWebBindingInitializer

      public void setWebBindingInitializer(@Nullable WebBindingInitializer webBindingInitializer)
      Provide a WebBindingInitializer with "global" initialization to apply to every DataBinder instance.
    • getWebBindingInitializer

      @Nullable public WebBindingInitializer getWebBindingInitializer()
      Return the configured WebBindingInitializer, or null if none.
    • setSessionAttributeStore

      public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore)
      Specify the strategy to store session attributes with. The default is DefaultSessionAttributeStore, 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 @SessionAttributes annotated 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 @SessionAttributes annotated handlers), this setting will apply to @SessionAttributes handlers 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 handleRequestInternal method 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_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.

      另请参阅:
    • 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)
      A ConfigurableBeanFactory is 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, or null if none.
    • setSessionManager

      public void setSessionManager(@Nullable SessionManager sessionManager)
    • afterPropertiesSet

      public void afterPropertiesSet()
      指定者:
      afterPropertiesSet 在接口中 cn.taketoday.beans.factory.InitializingBean
    • supportsInternal

      protected boolean supportsInternal(HandlerMethod handlerMethod)
      Always return true since 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
      从类复制的说明: AbstractHandlerMethodAdapter
      Use the given handler method to handle the request.
      指定者:
      handleInternal 在类中 AbstractHandlerMethodAdapter
      参数:
      request - current HTTP request
      handlerMethod - handler method to use. This object must have previously been passed to the AbstractHandlerMethodAdapter.supportsInternal(HandlerMethod) this interface, which must have returned true.
      返回:
      an object to render, or null
      抛出:
      Exception - in case of errors
      Throwable
    • getSession

      @Nullable private WebSession getSession(RequestContext request)
    • invokeHandlerMethod

      @Nullable protected Object invokeHandlerMethod(RequestContext request, HandlerMethod handlerMethod) throws Throwable
      Invoke the RequestMapping handler method preparing a ModelAndView if view resolution is required.
      抛出:
      Throwable
      另请参阅: