类 DefaultSessionManager

java.lang.Object
cn.taketoday.session.DefaultSessionManager
所有已实现的接口:
SessionManager

public class DefaultSessionManager extends Object implements SessionManager
Default implementation of SessionManager delegating to a SessionIdResolver for session id resolution and to a SessionRepository.
从以下版本开始:
2019-09-27 19:58
作者:
Harry Yang
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • setSessionRepository

      public void setSessionRepository(SessionRepository sessionRepository)
    • setSessionIdResolver

      public void setSessionIdResolver(SessionIdResolver sessionIdResolver)
    • createSession

      public WebSession createSession()
      从接口复制的说明: SessionManager
      create a new session
      指定者:
      createSession 在接口中 SessionManager
    • createSession

      public WebSession createSession(RequestContext context)
      从接口复制的说明: SessionManager
      create a new session associated with RequestContext
      指定者:
      createSession 在接口中 SessionManager
    • getSession

      @Nullable public WebSession getSession(@Nullable String sessionId)
      从接口复制的说明: SessionManager
      Get a session with given session id

      If there is not a session,create one.

      指定者:
      getSession 在接口中 SessionManager
    • getSession

      public WebSession getSession(RequestContext context)
      从接口复制的说明: SessionManager
      Returns the current session associated with this request, or if the request does not have a session, creates one.
      指定者:
      getSession 在接口中 SessionManager
      参数:
      context - Current request
      返回:
      the WebSession associated with this request
      另请参阅:
    • getSession

      @Nullable public WebSession getSession(RequestContext context, boolean create)
      从接口复制的说明: SessionManager
      Returns the current WebSession associated with this request or, if there is no current session and create is true, returns a new session.

      If create is false and the request has no valid WebSession, this method returns null.

      To make sure the session is properly maintained, you must call this method before the response is committed. If the container is using cookies to maintain session integrity and is asked to create a new session when the response is committed, an IllegalStateException is thrown.

      指定者:
      getSession 在接口中 SessionManager
      参数:
      context - Current request
      create - true to create a new session for this request if necessary; false to return null if there's no current session
      返回:
      the WebSession associated with this request or null if create is false and the request has no valid session
      另请参阅:
    • getSessionIdResolver

      public SessionIdResolver getSessionIdResolver()
    • getSessionRepository

      public SessionRepository getSessionRepository()