Class SessionCookieConfig

  • All Implemented Interfaces:
    SessionConfig

    public class SessionCookieConfig
    extends java.lang.Object
    implements SessionConfig
    Encapsulation of session cookie configuration. This removes the need for the session manager to know about cookie configuration.
    Author:
    Stuart Douglas
    • Field Detail

      • DEFAULT_SESSION_ID

        public static final java.lang.String DEFAULT_SESSION_ID
        See Also:
        Constant Field Values
    • Constructor Detail

      • SessionCookieConfig

        public SessionCookieConfig()
    • Method Detail

      • rewriteUrl

        public java.lang.String rewriteUrl​(java.lang.String originalUrl,
                                           java.lang.String sessionId)
        Specified by:
        rewriteUrl in interface SessionConfig
      • setSessionId

        public void setSessionId​(HttpServerExchange exchange,
                                 java.lang.String sessionId)
        Description copied from interface: SessionConfig
        Attaches the session to the exchange. The method should attach the exchange under an attachment key, and should also modify the exchange to allow the session to be re-attached on the next request.

        Generally this will involve setting a cookie

        Once a session has been attached it must be possible to retrieve it via SessionConfig.findSessionId(io.undertow.server.HttpServerExchange)

        Specified by:
        setSessionId in interface SessionConfig
        Parameters:
        exchange - The exchange
        sessionId - The session
      • clearSession

        public void clearSession​(HttpServerExchange exchange,
                                 java.lang.String sessionId)
        Description copied from interface: SessionConfig
        Clears this session from the exchange, removing the attachment and making any changes to the response necessary, such as clearing cookies.
        Specified by:
        clearSession in interface SessionConfig
        Parameters:
        exchange - The exchange
        sessionId - The session id
      • findSessionId

        public java.lang.String findSessionId​(HttpServerExchange exchange)
        Description copied from interface: SessionConfig
        Retrieves a session id of an existing session from an exchange.
        Specified by:
        findSessionId in interface SessionConfig
        Parameters:
        exchange - The exchange
        Returns:
        The session id, or null
      • getCookieName

        public java.lang.String getCookieName()
      • getPath

        public java.lang.String getPath()
      • getDomain

        public java.lang.String getDomain()
      • isDiscard

        public boolean isDiscard()
      • isSecure

        public boolean isSecure()
      • isHttpOnly

        public boolean isHttpOnly()
      • getMaxAge

        public int getMaxAge()
      • getComment

        public java.lang.String getComment()