public class Session extends Object
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.
original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<Session> |
__TYPE_ARG |
Constructor and Description |
---|
Session(Object delegate) |
Session(Session delegate) |
Modifier and Type | Method and Description |
---|---|
Session |
computeIfAbsent(String key,
java.util.function.Function<String,Object> mappingFunction)
Put some data in a session if absent.
|
Map<String,Object> |
data() |
void |
destroy()
Destroy the session
|
boolean |
equals(Object o) |
<T> T |
get(String key)
Get some data from the session
|
Session |
getDelegate() |
int |
hashCode() |
String |
id() |
boolean |
isDestroyed() |
boolean |
isEmpty() |
boolean |
isRegenerated() |
long |
lastAccessed() |
static Session |
newInstance(Session arg) |
String |
oldId() |
Session |
put(String key,
Object obj)
Put some data in a session
|
Session |
putIfAbsent(String key,
Object obj)
Put some data in a session if absent
|
Session |
regenerateId() |
<T> T |
remove(String key)
Remove some data from the session
|
void |
setAccessed()
Mark the session as being accessed.
|
long |
timeout() |
String |
toString() |
String |
value()
The short representation of the session to be added to the session cookie.
|
public static final io.vertx.lang.rx.TypeArg<Session> __TYPE_ARG
public Session getDelegate()
public Session regenerateId()
public String id()
public Session put(String key, Object obj)
key
- the key for the dataobj
- the datapublic Session putIfAbsent(String key, Object obj)
key
- the key for the dataobj
- the datapublic Session computeIfAbsent(String key, java.util.function.Function<String,Object> mappingFunction)
null
), attempts to compute its value using the given mapping
function and enters it into this map unless null
.key
- the key for the datamappingFunction
- a mapping functionpublic <T> T get(String key)
key
- the key of the datapublic <T> T remove(String key)
key
- the key of the datapublic boolean isEmpty()
public long lastAccessed()
public void destroy()
public boolean isDestroyed()
public boolean isRegenerated()
public String oldId()
public long timeout()
public void setAccessed()
public String value()
Copyright © 2022 Eclipse. All rights reserved.