Class HttpSessionHandler

java.lang.Object
dev.katsute.simplehttpserver.HttpSessionHandler

public class HttpSessionHandler extends Object
The session handler is used to assign sessions to exchanges.
Since:
5.0.0
Version:
5.0.0
Author:
Katsute
See Also:
  • Constructor Details

    • HttpSessionHandler

      public HttpSessionHandler()
      Creates a session handler using the cookie __session-id.
      Since:
      5.0.0
    • HttpSessionHandler

      public HttpSessionHandler(String cookie)
      Creates a session handler using a specified cookie.
      Parameters:
      cookie - cookie to use for session ID
      Since:
      5.0.0
  • Method Details

    • assignSessionID

      public String assignSessionID(HttpExchange exchange)
      Assigns a unique session ID to an exchange.
      Parameters:
      exchange - http exchange
      Returns:
      unique session ID
      Since:
      5.0.0
    • getSession

      public final HttpSession getSession(HttpExchange exchange)
      Returns the session associated with a particular exchange.
      Parameters:
      exchange - http exchange
      Returns:
      session associated with exchange
      Since:
      5.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Object