Interface Session

  • All Superinterfaces:
    javax.servlet.http.HttpSession

    public interface Session
    extends javax.servlet.http.HttpSession
    Represents a user's session (login session) in the system. Can hold some additional attributes as needed, but the underlying implementation may limit the number and size of attributes to ensure session replication is not impacted negatively.
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    • Method Detail

      • getSessionId

        String getSessionId()
        Returns:
        the session identifier. This is not the HttpSession.getId() from HttpSession unless no session id was specified when the session was bound.
      • getUserId

        String getUserId()
        Return the internal user ID for this session.
        Returns:
        internal user ID for the user using this session. This is null if the session is anonymous.
      • getUserEID

        String getUserEID()
        Get the external/enterprise user ID for this session.
        Returns:
        the external/enterprise user id of the user associated with this session
      • isActive

        boolean isActive()
        Returns:
        true if this session is active OR false if the session has timed out or been invalidated
      • getServerId

        String getServerId()
        Returns:
        id of the server with which this session is associated.
      • getOriginatingHostIP

        String getOriginatingHostIP()
        Returns:
        the IP Address from which this session originated
      • getOriginatingHostName

        String getOriginatingHostName()
        Returns:
        the hostname from which this session originated
      • getAttribute

        String getAttribute​(String key)
        Get an attribute from the session if one exists.
        Specified by:
        getAttribute in interface javax.servlet.http.HttpSession
        Parameters:
        key - the key for the attribute
        Returns:
        the value if one exists OR null if none
      • setAttribute

        void setAttribute​(String key,
                          String value)
        Set an attribute on a session.
        Parameters:
        key - the key for the attribute
        value - the value (if this is null then the attribute is removed)
      • getAttributes

        Map<String,​String> getAttributes()
        Get all attributes of this session.
        Returns:
        a copy of the attributes in this session. Modifying it has no effect on the session attributes.
      • clear

        void clear()
        Purges all data from this session and effectively resets it to an anonymous session. Does not invalidate the session, though.