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.
Constructor and description |
---|
Session
(java.lang.Object delegate) |
Type | Name and description |
---|---|
void |
destroy() Destroy the session |
T |
get(java.lang.String key) Get some data from the session |
java.lang.Object |
getDelegate() |
java.lang.String |
id()
|
boolean |
isDestroyed()
|
long |
lastAccessed() @return
|
Session |
put(java.lang.String key, java.lang.Object obj) Put some data in a session |
T |
remove(java.lang.String key) Remove some data from the session |
void |
setAccessed() Mark the session as being accessed. |
long |
timeout()
|
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Destroy the session
Get some data from the session
key
- the key of the data
Put some data in a session
key
- the key for the dataobj
- the dataRemove some data from the session
key
- the key of the dataMark the session as being accessed.