Package org.bzdev.net

Interface HttpSessionOps

All Known Implementing Classes:
EjwsStateTable

public interface HttpSessionOps
Operations for managing an HTTP session. The type parameter T is the type of the session implementation and can be used to reference an application-specific data structure. Each session is represented by a string that provides a session ID.

For the class EmbeddedWebServer, the method EmbeddedWebServer.addSessionFilter(String,HttpSessionOps) should be called to install a specific instance of this class. For EmbeddedWebServer, the class EjwsStateTable will provide a suitable implementation of this class. The method EmbeddedWebServer.addSessionFilter(String,boolean) can install EjwsStateTable as a default.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determine if this object recognizes a session ID.
    get(String sid)
    Get the session implementation associated with a session ID.
    void
    put(String sid, Object state)
    Add a session ID to this object.
    void
    Remove a session ID from this object.
    void
    rename(String oldID, String newID)
    Rename a session implementation by changing the session ID referencing it.
  • Method Details

    • remove

      void remove(String sid)
      Remove a session ID from this object.
      Parameters:
      sid - the session ID
    • put

      void put(String sid, Object state)
      Add a session ID to this object. This method is responsible for creating a new session implementation, but must not change an existing one. If the session ID already exists, nothing is added or removed.
      Parameters:
      sid - the session ID
      state - an object representing the state of a session
    • rename

      void rename(String oldID, String newID) throws IllegalStateException
      Rename a session implementation by changing the session ID referencing it.
      Parameters:
      oldID - the existing sessionID
      newID - the new sessionID
      Throws:
      IllegalStateException - oldID was not already added or newID was already added
    • contains

      boolean contains(String sid)
      Determine if this object recognizes a session ID.
      Parameters:
      sid - the session ID
      Returns:
      true if the session exists; false otherwise
    • get

      Object get(String sid)
      Get the session implementation associated with a session ID.
      Parameters:
      sid - the session ID
      Returns:
      the session implementation