AUTHENTICITY_KEY, EXPIRY_TIME_KEY, ID_KEY, TIMESTAMP_KEY
Constructor and Description |
---|
SessionImpl(Crypto crypto,
CookieEncryption encryption,
NinjaProperties ninjaProperties,
Clock clock) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all values from the session.
|
String |
get(String key)
Returns the value of the key or null.
|
String |
getAuthenticityToken() |
Map<String,String> |
getData() |
String |
getId() |
void |
init(Context context)
Has to be called initially.
|
boolean |
isEmpty()
Returns true if the session is empty, e.g.
|
void |
put(String key,
String value)
Puts key / value into the session.
|
String |
remove(String key)
Removes the value of the key and returns the value or null.
|
void |
save(Context context)
To finally send this session to the user this method has to be called.
|
void |
setExpiryTime(Long expiryTimeMs)
Use an alternative expiry time, this can be used to implement a longer
expiry time for 'remember me' style functionality.
|
protected boolean |
shouldExpire() |
@Inject public SessionImpl(Crypto crypto, CookieEncryption encryption, NinjaProperties ninjaProperties, Clock clock)
public void init(Context context)
Session
protected boolean shouldExpire()
public void setExpiryTime(Long expiryTimeMs)
Session
setExpiryTime
in interface Session
expiryTimeMs
- the expiry time in milliseconds, set to null to remove
the expiry time from the session and use the application
default.public String getAuthenticityToken()
getAuthenticityToken
in interface Session
public void save(Context context)
Session
public void put(String key, String value)
Session
public String get(String key)
Session
public String remove(String key)
Session
public void clear()
Session
public boolean isEmpty()
Session
Copyright © 2019 ninjaframework. All rights reserved.