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)
Sessionprotected boolean shouldExpire()
public void setExpiryTime(Long expiryTimeMs)
SessionsetExpiryTime in interface SessionexpiryTimeMs - 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 Sessionpublic void save(Context context)
Sessionpublic void put(String key, String value)
Sessionpublic String get(String key)
Sessionpublic String remove(String key)
Sessionpublic void clear()
Sessionpublic boolean isEmpty()
SessionCopyright © 2019 ninjaframework. All rights reserved.