Class DefaultHttpSessionManager

java.lang.Object
cloud.piranha.webapp.impl.DefaultHttpSessionManager
All Implemented Interfaces:
HttpSessionManager, SessionCookieConfig

public class DefaultHttpSessionManager
extends java.lang.Object
implements HttpSessionManager, SessionCookieConfig
The default HttpSessionManager.
Author:
Manfred Riem ([email protected])
  • Field Details

    • attributeListeners

      protected final java.util.ArrayList<HttpSessionAttributeListener> attributeListeners
      Stores the session listeners.
    • comment

      protected java.lang.String comment
      Stores the comment.
    • defaultSessionTrackingModes

      protected final java.util.Set<SessionTrackingMode> defaultSessionTrackingModes
      Stores the default session tracking modes.
    • domain

      protected java.lang.String domain
      Stores the domain.
    • httpOnly

      protected boolean httpOnly
      Stores the HTTP only flag.
    • idListeners

      protected final java.util.ArrayList<HttpSessionIdListener> idListeners
      Stores the session id listeners.
    • maxAge

      protected int maxAge
      Stores the max age.
    • name

      protected java.lang.String name
      Stores the name.
    • path

      protected java.lang.String path
      Stores the path.
    • secure

      protected boolean secure
      Stores the secure flag.
    • sessionListeners

      protected final java.util.ArrayList<HttpSessionListener> sessionListeners
      Stores the session listeners.
    • sessionTimeout

      protected int sessionTimeout
      Stores the session timeout (in minutes).
    • sessionTrackingModes

      protected java.util.Set<SessionTrackingMode> sessionTrackingModes
      Stores the session tracking modes.
    • sessions

      protected java.util.Map<java.lang.String,​HttpSession> sessions
      Stores the sessions.
    • webApplication

      protected WebApplication webApplication
      Stores the web application.
  • Constructor Details

    • DefaultHttpSessionManager

      public DefaultHttpSessionManager()
      Constructor.
  • Method Details

    • createSession

      public HttpSession createSession​(HttpServletRequest request)
      Description copied from interface: HttpSessionManager
      Create a session.
      Specified by:
      createSession in interface HttpSessionManager
      Parameters:
      request - the request.
      Returns:
      the session.
    • getSession

      public HttpSession getSession​(HttpServletRequest request, java.lang.String currentSessionId)
      Description copied from interface: HttpSessionManager
      Get the session.
      Specified by:
      getSession in interface HttpSessionManager
      Parameters:
      request - the request.
      currentSessionId - the current session id.
      Returns:
      the session.
    • changeSessionId

      public java.lang.String changeSessionId​(HttpServletRequest request)
      Change the session id.
      Specified by:
      changeSessionId in interface HttpSessionManager
      Parameters:
      request - the request.
      Returns:
      the session id.
    • addListener

      public <T extends java.util.EventListener> void addListener​(T listener)
      Add a listener.
      Specified by:
      addListener in interface HttpSessionManager
      Type Parameters:
      T - the type.
      Parameters:
      listener - the listener.
    • attributeAdded

      public void attributeAdded​(HttpSession session, java.lang.String name, java.lang.Object value)
      Attribute added.
      Specified by:
      attributeAdded in interface HttpSessionManager
      Parameters:
      session - the HTTP session.
      name - the name.
      value - the value.
    • attributeReplaced

      public void attributeReplaced​(HttpSession session, java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
      Attribute replaced.
      Specified by:
      attributeReplaced in interface HttpSessionManager
      Parameters:
      session - the HTTP session.
      name - the name.
      oldValue - the old value.
      newValue - the new value.
    • attributeRemoved

      public void attributeRemoved​(HttpSession session, java.lang.String name, java.lang.Object value)
      Description copied from interface: HttpSessionManager
      Attribute removed.
      Specified by:
      attributeRemoved in interface HttpSessionManager
      Parameters:
      session - the HTTP session.
      name - the name.
      value - the value.
    • destroySession

      public void destroySession​(HttpSession session)
      Destroy the session.
      Specified by:
      destroySession in interface HttpSessionManager
      Parameters:
      session - the session.
    • encodeRedirectURL

      public java.lang.String encodeRedirectURL​(HttpServletResponse response, java.lang.String url)
      Encode the redirect URL.
      Specified by:
      encodeRedirectURL in interface HttpSessionManager
      Parameters:
      response - the response.
      url - the redirect url.
      Returns:
      the encoded redirect url.
    • encodeURL

      public java.lang.String encodeURL​(HttpServletResponse response, java.lang.String url)
      Encode the URL.
      Specified by:
      encodeURL in interface HttpSessionManager
      Parameters:
      response - the response.
      url - the url.
      Returns:
      the encoded url.
    • getComment

      public java.lang.String getComment()
      Get the comment.
      Specified by:
      getComment in interface SessionCookieConfig
      Returns:
      the comment.
    • getDefaultSessionTrackingModes

      public java.util.Set<SessionTrackingMode> getDefaultSessionTrackingModes()
      Get the default session tracking modes.
      Specified by:
      getDefaultSessionTrackingModes in interface HttpSessionManager
      Returns:
      the default session tracking modes.
    • getDomain

      public java.lang.String getDomain()
      Get the domain.
      Specified by:
      getDomain in interface SessionCookieConfig
      Returns:
      the domain.
    • getEffectiveSessionTrackingModes

      public java.util.Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
      Get the effective session tracking modes.
      Specified by:
      getEffectiveSessionTrackingModes in interface HttpSessionManager
      Returns:
      the effective session tracking modes.
    • getMaxAge

      public int getMaxAge()
      Get the max age.
      Specified by:
      getMaxAge in interface SessionCookieConfig
      Returns:
      the max age.
    • getName

      public java.lang.String getName()
      Get the name.
      Specified by:
      getName in interface SessionCookieConfig
      Returns:
      the name.
    • getPath

      public java.lang.String getPath()
      Get the path.
      Specified by:
      getPath in interface SessionCookieConfig
      Returns:
      the path.
    • getSessionCookieConfig

      public SessionCookieConfig getSessionCookieConfig()
      Get the session cookie config.
      Specified by:
      getSessionCookieConfig in interface HttpSessionManager
      Returns:
      the session cookie config.
    • getSessionTimeout

      public int getSessionTimeout()
      Get the session timeout (in minutes).
      Specified by:
      getSessionTimeout in interface HttpSessionManager
      Returns:
      the session timeout.
    • hasSession

      public boolean hasSession​(java.lang.String sessionId)
      Has a session with the given id.
      Specified by:
      hasSession in interface HttpSessionManager
      Parameters:
      sessionId - the session id.
      Returns:
      true if there is one, false otherwise.
    • isHttpOnly

      public boolean isHttpOnly()
      Is HTTP only?
      Specified by:
      isHttpOnly in interface SessionCookieConfig
      Returns:
      true if HTTP only, false otherwise.
    • isSecure

      public boolean isSecure()
      Is secure.
      Specified by:
      isSecure in interface SessionCookieConfig
      Returns:
      the secure flag.
    • setComment

      public void setComment​(java.lang.String comment)
      Description copied from interface: SessionCookieConfig
      Set the comment.
      Specified by:
      setComment in interface SessionCookieConfig
      Parameters:
      comment - the comment.
    • setDomain

      public void setDomain​(java.lang.String domain)
      Description copied from interface: SessionCookieConfig
      Set the domain.
      Specified by:
      setDomain in interface SessionCookieConfig
      Parameters:
      domain - the domain.
    • setHttpOnly

      public void setHttpOnly​(boolean httpOnly)
      Description copied from interface: SessionCookieConfig
      Set the HTTP-only flag.
      Specified by:
      setHttpOnly in interface SessionCookieConfig
      Parameters:
      httpOnly - the HTTP-only flag.
    • setMaxAge

      public void setMaxAge​(int maxAge)
      Description copied from interface: SessionCookieConfig
      Set the max age.
      Specified by:
      setMaxAge in interface SessionCookieConfig
      Parameters:
      maxAge - the max age.
    • setName

      public void setName​(java.lang.String name)
      Description copied from interface: SessionCookieConfig
      Set the name.
      Specified by:
      setName in interface SessionCookieConfig
      Parameters:
      name - the name.
    • setPath

      public void setPath​(java.lang.String path)
      Description copied from interface: SessionCookieConfig
      Set the path.
      Specified by:
      setPath in interface SessionCookieConfig
      Parameters:
      path - the path.
    • setSecure

      public void setSecure​(boolean secure)
      Description copied from interface: SessionCookieConfig
      Set the secure flag.
      Specified by:
      setSecure in interface SessionCookieConfig
      Parameters:
      secure - the secure flag.
    • setSessionTimeout

      public void setSessionTimeout​(int sessionTimeout)
      Set the session timeout.
      Specified by:
      setSessionTimeout in interface HttpSessionManager
      Parameters:
      sessionTimeout - the session timeout.
    • setSessionTrackingModes

      public void setSessionTrackingModes​(java.util.Set<SessionTrackingMode> sessionTrackingModes)
      Set the session tracking modes.
      Specified by:
      setSessionTrackingModes in interface HttpSessionManager
      Parameters:
      sessionTrackingModes - the session tracking modes.
    • setWebApplication

      public void setWebApplication​(WebApplication webApplication)
      Set the web application.
      Specified by:
      setWebApplication in interface HttpSessionManager
      Parameters:
      webApplication - the web application.