java.lang.Object
io.jooby.SessionStore.InMemory
- All Implemented Interfaces:
SessionStore
- Enclosing interface:
- SessionStore
Base class for in-memory session store.
- Since:
- 2.0.0
- Author:
- edgar.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jooby.SessionStore
SessionStore.InMemory -
Field Summary
Fields inherited from interface io.jooby.SessionStore
DEFAULT_TIMEOUT -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSession(Context ctx, Session session) Delete a session from store.findSession(Context ctx) Find an existing session by ID.getToken()Session token.newSession(Context ctx) Creates a new session.voidrenewSessionId(Context ctx, Session session) Renew Session ID.voidsaveSession(Context ctx, Session session) Save a session.setToken(SessionToken token) Set custom session token.voidtouchSession(Context ctx, Session session) Session attributes/state has changed.
-
Method Details
-
newSession
Description copied from interface:SessionStoreCreates a new session. This method must:- Set session as new
Session.setNew(boolean)- Optionally, set session creation timeSession.setCreationTime(Instant)- Optionally, set session last accessed timeSession.setLastAccessedTime(Instant)- Specified by:
newSessionin interfaceSessionStore- Parameters:
ctx- Web context.- Returns:
- A new session.
-
getToken
Session token.- Returns:
- Session token. Uses a cookie by default:
SessionToken.SID.
-
setToken
Set custom session token.- Parameters:
token- Session token.- Returns:
- This store.
-
findSession
Description copied from interface:SessionStoreFind an existing session by ID. For existing session this method must:- Optionally, Retrieve/restore session creation time - Optionally, Set session last accessed time
Session.setLastAccessedTime(Instant)- Specified by:
findSessionin interfaceSessionStore- Parameters:
ctx- Web context.- Returns:
- An existing session or
null.
-
deleteSession
Description copied from interface:SessionStoreDelete a session from store. This method must NOT callSession.destroy().- Specified by:
deleteSessionin interfaceSessionStore- Parameters:
ctx- Web context.session- Current session.
-
touchSession
Description copied from interface:SessionStoreSession attributes/state has changed. Every time a session attribute is put or removed it, this method is executed as notification callback.- Specified by:
touchSessionin interfaceSessionStore- Parameters:
ctx- Web context.session- Current session.
-
saveSession
Description copied from interface:SessionStoreSave a session. This method must save:- Session attributes/data - Optionally set Session metadata like: creationTime, lastAccessed time, etc.
This method is call after response is send to client, so context and response shouldn't be modified.
- Specified by:
saveSessionin interfaceSessionStore- Parameters:
ctx- Web context.session- Current session.
-
renewSessionId
Description copied from interface:SessionStoreRenew Session ID. This operation might or might not be implemented by a Session Store.- Specified by:
renewSessionIdin interfaceSessionStore- Parameters:
ctx- Web Context.session- Session.
-