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 TypeMethodDescriptionvoid
deleteSession
(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.void
renewSessionId
(Context ctx, Session session) Renew Session ID.void
saveSession
(Context ctx, Session session) Save a session.setToken
(SessionToken token) Set custom session token.void
touchSession
(Context ctx, Session session) Session attributes/state has changed.
-
Method Details
-
newSession
Description copied from interface:SessionStore
Creates 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:
newSession
in 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:SessionStore
Find 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:
findSession
in interfaceSessionStore
- Parameters:
ctx
- Web context.- Returns:
- An existing session or
null
.
-
deleteSession
Description copied from interface:SessionStore
Delete a session from store. This method must NOT callSession.destroy()
.- Specified by:
deleteSession
in interfaceSessionStore
- Parameters:
ctx
- Web context.session
- Current session.
-
touchSession
Description copied from interface:SessionStore
Session attributes/state has changed. Every time a session attribute is put or removed it, this method is executed as notification callback.- Specified by:
touchSession
in interfaceSessionStore
- Parameters:
ctx
- Web context.session
- Current session.
-
saveSession
Description copied from interface:SessionStore
Save 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:
saveSession
in interfaceSessionStore
- Parameters:
ctx
- Web context.session
- Current session.
-
renewSessionId
Description copied from interface:SessionStore
Renew Session ID. This operation might or might not be implemented by a Session Store.- Specified by:
renewSessionId
in interfaceSessionStore
- Parameters:
ctx
- Web Context.session
- Session.
-