Klasse SessionToken

java.lang.Object
de.srsoftware.tools.Cookie
de.srsoftware.tools.SessionToken
Alle implementierten Schnittstellen:
Map.Entry<String,String>

public class SessionToken extends Cookie
a special cookies allowing to keep track of a session
  • Konstruktordetails

    • SessionToken

      public SessionToken(String sessionId, String path, Instant expiration, boolean trust)
      create a new sessoin token cookie carrying the given session id
      Parameter:
      sessionId - a string to provide as sesstionToken cookie
      path - the path this cookie is valid for
      expiration - the time when the cookie is about to expire
      trust - whether the cookie shall be persistent
    • SessionToken

      public SessionToken(String sessionId)
      create a new sessoin token cookie carrying the given session id
      Parameter:
      sessionId - a string to provide as sesstionToken cookie
  • Methodendetails

    • addTo

      public <T extends Cookie> T addTo(Headers headers)
      Beschreibung aus Klasse kopiert: Cookie
      add this cookie instance to a Headers object
      Setzt außer Kraft:
      addTo in Klasse Cookie
      Typparameter:
      T - the type of this cookie
      Parameter:
      headers - the headers object, to which this cookie is added
      Gibt zurück:
      this cookie
    • from

      public static Optional<SessionToken> from(HttpExchange ex)
      extract the session token from an HttpExchange
      Parameter:
      ex - the exchange to extract from
      Gibt zurück:
      an optional carrying a session token, if one was submitted in the exchange
    • sessionId

      public String sessionId()
      return the string carried by this session token instance
      Gibt zurück:
      the carried id