Represents a browser session.

Sessions persist between HTTP requests for a single browser session. They are deleted when the browser is closed, or they time-out. Session cookies are used to maintain sessions using a secure UUID.

Sessions can be used to maintain data for a browser session, e.g. a shopping basket.

The context must have first been routed to a SessionHandler for sessions to be available.

  • Session
    • Basic
      • Identifiable
      • Object
        • Anything

no subtypes hierarchy

Initializer
Session(Session unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
destroyshared default void destroy()

Destroy the session

getshared default T? get<T>(String key)

Get some data from the session

Parameters:
  • key

    the key of the data

idshared default String id()

@return The unique ID of the session. This is generated using a random secure UUID.

isDestroyedshared default Boolean isDestroyed()

@return has the session been destroyed?

lastAccessedshared default Integer lastAccessed()

@return the time the session was last accessed

putshared default Session put(String key, Object? obj)

Put some data in a session

Parameters:
  • key

    the key for the data

  • obj

    the data

removeshared default T? remove<T>(String key)

Remove some data from the session

Parameters:
  • key

    the key of the data

setAccessedshared default void setAccessed()

Mark the session as being accessed.

timeoutshared default Integer timeout()

@return the amount of time in ms, after which the session will expire, if not accessed.

Inherited Methods
Methods inherited from: Object
equals