Interface HttpSessionModel

  • All Known Implementing Classes:
    AbstractHttpSessionModel, MonolithicHttpSessionModel, SplitHttpSessionModel, TraditionalHttpSessionModel

    public interface HttpSessionModel
    This is the abstract model for HttpSession implementations that support clustering.

    The model contains the following properties:

    • String Id
    • long CreationTime
    • long LastAccessedTime
    • int MaxInactiveInterval
    • boolean New
    • boolean Valid
    • Attribute[] {Name, Value}

    This interface is intended to be a logical terminal.

    Version:
    Coherence 2.3
    Author:
    cp 2003.07.28
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Object getAttribute​(String sName)
      Returns the object bound with the specified name in this session, or null if no object is bound under the name.
      String[] getAttributeNameArray()
      Returns an array of attribute names for this session.
      long getCreationTime()
      Returns the creation time for this session.
      String getId()
      Returns the session identifier for this session.
      long getLastAccessedTime()
      Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT.
      int getMaxInactiveInterval()
      Returns the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
      int getReferenceCount()
      Determine the reference count (unmatched enter calls) for this model.
      boolean isExpired()
      A helper method to determine if the session data has expired.
      boolean isNew()
      Returns true if the client does not yet know about the session or if the client chooses not to join the session.
      boolean isUsable()
      Determine if this session model is a usable object.
      boolean isValid()
      Determine if this session model is valid.
      void removeAttribute​(String sName)
      Removes the object bound with the specified name from this session.
      void sessionReturned()
      Indicates to the session that it is no longer new, because the session ID has been returned to the client to allow the client to accept it, as described in the Servlet specification.
      void setAttribute​(String sName, Object oValue)
      Binds an object to this session, using the name specified.
      void setMaxInactiveInterval​(int cSeconds)
      Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session.
      void touch()
      Update the last-accessed time for the session.
    • Method Detail

      • getAttribute

        Object getAttribute​(String sName)
        Returns the object bound with the specified name in this session, or null if no object is bound under the name.
        Parameters:
        sName - a string specifying the name of the object
        Returns:
        the object with the specified name
        Throws:
        IllegalStateException - if this method is called on an invalidated session
      • getAttributeNameArray

        String[] getAttributeNameArray()
        Returns an array of attribute names for this session.
        Returns:
        an array of String objects specifying the names of all the objects bound to this session
        Throws:
        IllegalStateException - if this method is called on an invalidated session
      • getCreationTime

        long getCreationTime()
        Returns the creation time for this session.
        Returns:
        the creation time for this session
      • getId

        String getId()
        Returns the session identifier for this session.
        Returns:
        the session identifier for this session.
      • getLastAccessedTime

        long getLastAccessedTime()
        Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
        Returns:
        the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time
      • getReferenceCount

        int getReferenceCount()
        Determine the reference count (unmatched enter calls) for this model.
        Returns:
        the reference count (unmatched enter calls) for this model
      • getMaxInactiveInterval

        int getMaxInactiveInterval()
        Returns the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.
        Returns:
        the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out
      • isExpired

        boolean isExpired()
        A helper method to determine if the session data has expired.
        Returns:
        true if the session served by this session model has expired
      • isNew

        boolean isNew()
        Returns true if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.
        Returns:
        true if the server has created a session, but the client has not yet joined
        Throws:
        IllegalStateException - if this method is called on an already invalidated session
      • isUsable

        boolean isUsable()
        Determine if this session model is a usable object. For example, a session model may become unusable if it is passivated and then held beyond the request scope.

        When a session model becomes unusable, the only method that can be assumed to respond without throwing an exception is getId().

        Returns:
        true if this session model object is still usable, false if the session model should be re-obtained from its collection
      • isValid

        boolean isValid()
        Determine if this session model is valid.
        Returns:
        true if the session has not been destroyed, otherwise false
      • removeAttribute

        void removeAttribute​(String sName)
        Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.
        Parameters:
        sName - the name of the object to remove from this session
        Throws:
        IllegalStateException - if this method is called on an invalidated session
      • sessionReturned

        void sessionReturned()
        Indicates to the session that it is no longer new, because the session ID has been returned to the client to allow the client to accept it, as described in the Servlet specification.
      • setAttribute

        void setAttribute​(String sName,
                          Object oValue)
        Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.
        Parameters:
        sName - the name to which the object is bound; cannot be null
        oValue - the object to be bound; cannot be null
        Throws:
        IllegalStateException - if this method is called on an invalidated session
      • setMaxInactiveInterval

        void setMaxInactiveInterval​(int cSeconds)
        Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. A negative time indicates that the session should never time out.
        Parameters:
        cSeconds - the new maximum interval
      • touch

        void touch()
        Update the last-accessed time for the session.