cloud.piranha

Class DefaultHttpSessionManager

  • All Implemented Interfaces:
    HttpSessionManager, javax.servlet.SessionCookieConfig


    public class DefaultHttpSessionManager
    extends Object
    implements HttpSessionManager, javax.servlet.SessionCookieConfig
    The default HttpSessionManager.
    Author:
    Manfred Riem (mriem@manorrock.com)
    • Field Detail

      • attributeListeners

        protected final ArrayList<javax.servlet.http.HttpSessionAttributeListener> attributeListeners
        Stores the session listeners.
      • comment

        protected String comment
        Stores the comment.
      • defaultSessionTrackingModes

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

        protected String domain
        Stores the domain.
      • httpOnly

        protected boolean httpOnly
        Stores the HTTP only flag.
      • idListeners

        protected final ArrayList<javax.servlet.http.HttpSessionIdListener> idListeners
        Stores the session id listeners.
      • maxAge

        protected int maxAge
        Stores the max age.
      • name

        protected String name
        Stores the name.
      • path

        protected String path
        Stores the path.
      • secure

        protected boolean secure
        Stores the secure flag.
      • sessionListeners

        protected final ArrayList<javax.servlet.http.HttpSessionListener> sessionListeners
        Stores the session listeners.
      • sessionTimeout

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

        protected Set<javax.servlet.SessionTrackingMode> sessionTrackingModes
        Stores the session tracking modes.
      • sessions

        protected Map<String,javax.servlet.http.HttpSession> sessions
        Stores the sessions.
      • webApplication

        protected WebApplication webApplication
        Stores the web application.
    • Constructor Detail

      • DefaultHttpSessionManager

        public DefaultHttpSessionManager()
        Constructor.
    • Method Detail

      • createSession

        public javax.servlet.http.HttpSession createSession(WebApplication webApplication,
                                                            javax.servlet.http.HttpServletRequest request)
        Create the session.
        Specified by:
        createSession in interface HttpSessionManager
        Parameters:
        webApplication - the web application.
        request - the request.
        Returns:
        the session.
      • getSession

        public javax.servlet.http.HttpSession getSession(WebApplication webApplication,
                                                         javax.servlet.http.HttpServletRequest request,
                                                         String currentSessionId)
        Get the session.
        Specified by:
        getSession in interface HttpSessionManager
        Parameters:
        webApplication - the web application.
        request - the request.
        currentSessionId - the current session id.
        Returns:
        the session.
      • changeSessionId

        public String changeSessionId(javax.servlet.http.HttpServletRequest request)
        Change the session id.
        Specified by:
        changeSessionId in interface HttpSessionManager
        Parameters:
        request - the request.
        Returns:
        the session id.
      • addListener

        public <T extends 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(javax.servlet.http.HttpSession session,
                                   String name,
                                   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(javax.servlet.http.HttpSession session,
                                      String name,
                                      Object value)
        Attribute removed.
        Specified by:
        attributeReplaced in interface HttpSessionManager
        Parameters:
        session - the HTTP session.
        name - the name.
        value - the value.
      • attributeRemoved

        public void attributeRemoved(javax.servlet.http.HttpSession session,
                                     String name)
        Attributed removed.
        Specified by:
        attributeRemoved in interface HttpSessionManager
        Parameters:
        session - the HTTP session.
        name - the name.
      • destroySession

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

        public String encodeRedirectURL(javax.servlet.http.HttpServletResponse response,
                                        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 String encodeURL(javax.servlet.http.HttpServletResponse response,
                                String url)
        Encode the URL.
        Specified by:
        encodeURL in interface HttpSessionManager
        Parameters:
        response - the response.
        url - the url.
        Returns:
        the encoded url.
      • getComment

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

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

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

        public Set<javax.servlet.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 javax.servlet.SessionCookieConfig
        Returns:
        the max age.
      • getName

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

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

        public javax.servlet.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(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 javax.servlet.SessionCookieConfig
        Returns:
        true if HTTP only, false otherwise.
      • isSecure

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

        public void setComment(String comment)
        Set the comment.
        Specified by:
        setComment in interface javax.servlet.SessionCookieConfig
        Parameters:
        comment - the comment.
      • setDomain

        public void setDomain(String domain)
        Set the domain.
        Specified by:
        setDomain in interface javax.servlet.SessionCookieConfig
        Parameters:
        domain - the domain
      • setHttpOnly

        public void setHttpOnly(boolean httpOnly)
        Set the HTTP only flag.
        Specified by:
        setHttpOnly in interface javax.servlet.SessionCookieConfig
        Parameters:
        httpOnly - the HTTP only flag.
      • setMaxAge

        public void setMaxAge(int maxAge)
        Set the max age.
        Specified by:
        setMaxAge in interface javax.servlet.SessionCookieConfig
        Parameters:
        maxAge - the max age.
      • setName

        public void setName(String name)
        Set the name.
        Specified by:
        setName in interface javax.servlet.SessionCookieConfig
        Parameters:
        name - the name.
      • setPath

        public void setPath(String path)
        Set the path.
        Specified by:
        setPath in interface javax.servlet.SessionCookieConfig
        Parameters:
        path - the path.
      • setSecure

        public void setSecure(boolean secure)
        Set the secure flag.
        Specified by:
        setSecure in interface javax.servlet.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(Set<javax.servlet.SessionTrackingMode> sessionTrackingModes)
        Set the session tracking modes.
        Specified by:
        setSessionTrackingModes in interface HttpSessionManager
        Parameters:
        sessionTrackingModes - the session tracking modes.

Copyright © 2020. All rights reserved.