public interface 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.
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
data() |
void |
destroy()
Destroy the session
|
<T> T |
get(String key)
Get some data from the session
|
String |
id() |
boolean |
isDestroyed() |
boolean |
isEmpty() |
boolean |
isRegenerated() |
long |
lastAccessed() |
String |
oldId() |
Session |
put(String key,
Object obj)
Put some data in a session
|
Session |
regenerateId() |
<T> T |
remove(String key)
Remove some data from the session
|
void |
setAccessed()
Mark the session as being accessed.
|
long |
timeout() |
default String |
value()
The short representation of the session to be added to the session cookie.
|
Session regenerateId()
String id()
Session put(String key, Object obj)
key
- the key for the dataobj
- the data<T> T get(String key)
key
- the key of the data<T> T remove(String key)
key
- the key of the databoolean isEmpty()
long lastAccessed()
void destroy()
boolean isDestroyed()
boolean isRegenerated()
String oldId()
long timeout()
void setAccessed()
default String value()
Copyright © 2023 Eclipse. All rights reserved.