Class RemoteSession

  • All Implemented Interfaces:
    jakarta.servlet.http.HttpSession, Serializable

    public class RemoteSession
    extends Object
    implements jakarta.servlet.http.HttpSession, Serializable
    Facade for the standard servlet HttpSession object.
    Author:
    Steve Ferris steve.ferris@forgerock.com
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteSession()
      Construct a new session facade.
      RemoteSession​(jakarta.servlet.http.HttpSession session)
      Construct a new session facade.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      Object getAttribute​(String name)
      Fetch the value of a given session attribute, either from local object pre serialization or the stored value post serialization.
      Enumeration getAttributeNames()
      Returns a list of attribute names, either from local object pre serialization or the stored value post serialization.
      long getCreationTime()
      The creation time of the session, either from local object pre serialization or the stored value post serialization.
      String getId()
      Returns the ID of the session, either from local object pre serialization or the stored value post serialization.
      long getLastAccessedTime()
      Returns the last accessed time of the session, either from local object pre serialization or the stored value post serialization.
      int getMaxInactiveInterval()
      Gets the maximum inactive session interval, either from local object pre serialization or the stored value post serialization.
      jakarta.servlet.ServletContext getServletContext()
      Returns the Servlet Context, either from local object pre serialization or the stored value post serialization.
      jakarta.servlet.http.HttpSessionContext getSessionContext()
      Deprecated. 
      Object getValue​(String name)
      Deprecated. 
      String[] getValueNames()
      Deprecated. 
      void invalidate()
      Invalidates this session, only works pre-serialization
      boolean isNew()
      Determines if the client knows about the session, either from local object pre serialization or the stored value post serialization.
      protected boolean isSerializable​(Object obj)
      Tests if an object implements the java.io.Serializable interface.
      void putValue​(String name, Object value)
      Deprecated. 
      void removeAttribute​(String name)
      Removes an attribute from the session, either from local object pre serialization or the stored value post serialization.
      void removeValue​(String name)
      Deprecated. 
      void setAttribute​(String name, Object value)
      Sets an attribute on the session, either from local object pre serialization or the stored value post serialization.
      void setMaxInactiveInterval​(int interval)
      Sets the maximum inactive session interval on the session, only works pre serialization
    • Constructor Detail

      • RemoteSession

        public RemoteSession​(jakarta.servlet.http.HttpSession session)
        Construct a new session facade. This class wraps the standard HttpSession object allowing it to become serializable.
        Parameters:
        session - The HttpSession object to be wrapped
      • RemoteSession

        public RemoteSession()
        Construct a new session facade. Used on the remote end post deserialization
    • Method Detail

      • getCreationTime

        public long getCreationTime()
        The creation time of the session, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getCreationTime in interface jakarta.servlet.http.HttpSession
        Returns:
        The session creation time
      • getId

        public String getId()
        Returns the ID of the session, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getId in interface jakarta.servlet.http.HttpSession
        Returns:
        The session id
      • getLastAccessedTime

        public long getLastAccessedTime()
        Returns the last accessed time of the session, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getLastAccessedTime in interface jakarta.servlet.http.HttpSession
        Returns:
        The last session accessed time
      • getServletContext

        public jakarta.servlet.ServletContext getServletContext()
        Returns the Servlet Context, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getServletContext in interface jakarta.servlet.http.HttpSession
        Returns:
        The servlet context
      • setMaxInactiveInterval

        public void setMaxInactiveInterval​(int interval)
        Sets the maximum inactive session interval on the session, only works pre serialization
        Specified by:
        setMaxInactiveInterval in interface jakarta.servlet.http.HttpSession
        Parameters:
        interval - The maximum inactivate interval
      • getMaxInactiveInterval

        public int getMaxInactiveInterval()
        Gets the maximum inactive session interval, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getMaxInactiveInterval in interface jakarta.servlet.http.HttpSession
        Returns:
        The maximum session inactive interval
      • getSessionContext

        public jakarta.servlet.http.HttpSessionContext getSessionContext()
        Deprecated.
        Returns the session context, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getSessionContext in interface jakarta.servlet.http.HttpSession
        Returns:
        The session context
      • getAttribute

        public Object getAttribute​(String name)
        Fetch the value of a given session attribute, either from local object pre serialization or the stored value post serialization. Only attributes that were serializable will be available post serialization
        Specified by:
        getAttribute in interface jakarta.servlet.http.HttpSession
        Parameters:
        name - The name of the attribute to return
        Returns:
        The value of the named attribute or null if not found or non-serializable
      • getValue

        public Object getValue​(String name)
        Deprecated.
        Same functionality as @see getAttribute.
        Specified by:
        getValue in interface jakarta.servlet.http.HttpSession
        Parameters:
        name - the name of the attribute to retrieve
        Returns:
        The value of the named attribute or null if not found or non-serializable
      • getAttributeNames

        public Enumeration getAttributeNames()
        Returns a list of attribute names, either from local object pre serialization or the stored value post serialization.
        Specified by:
        getAttributeNames in interface jakarta.servlet.http.HttpSession
        Returns:
        The attributes names
      • getValueNames

        public String[] getValueNames()
        Deprecated.
        Returns a list of value names, @see getAttributeNames
        Specified by:
        getValueNames in interface jakarta.servlet.http.HttpSession
        Returns:
        The value names
      • setAttribute

        public void setAttribute​(String name,
                                 Object value)
        Sets an attribute on the session, either from local object pre serialization or the stored value post serialization.
        Specified by:
        setAttribute in interface jakarta.servlet.http.HttpSession
        Parameters:
        name - The name of the attribute to set
        value - The attributes value
      • putValue

        public void putValue​(String name,
                             Object value)
        Deprecated.
        see @setAttribute
        Specified by:
        putValue in interface jakarta.servlet.http.HttpSession
        Parameters:
        name - The name of the value to set
        value - The value of the value being set
      • removeAttribute

        public void removeAttribute​(String name)
        Removes an attribute from the session, either from local object pre serialization or the stored value post serialization.
        Specified by:
        removeAttribute in interface jakarta.servlet.http.HttpSession
        Parameters:
        name - The name of the attribute to remove
      • removeValue

        public void removeValue​(String name)
        Deprecated.
        Specified by:
        removeValue in interface jakarta.servlet.http.HttpSession
        Parameters:
        name - The name of the value to remove
        See Also:
        removeAttribute(java.lang.String)
      • invalidate

        public void invalidate()
        Invalidates this session, only works pre-serialization
        Specified by:
        invalidate in interface jakarta.servlet.http.HttpSession
      • isNew

        public boolean isNew()
        Determines if the client knows about the session, either from local object pre serialization or the stored value post serialization.
        Specified by:
        isNew in interface jakarta.servlet.http.HttpSession
        Returns:
        true if unknown to the client
      • isSerializable

        protected boolean isSerializable​(Object obj)
        Tests if an object implements the java.io.Serializable interface.
        Parameters:
        obj - The obj to test for serialization.
        Returns:
        true if the object implements Serializable, false otherwise.