Package org.spincast.plugins.session
Interface SpincastSessionManager
- All Known Implementing Classes:
SpincastSessionManagerDefault
public interface SpincastSessionManager
Manager for
SpincastSession.-
Method Summary
Modifier and TypeMethodDescriptionCreates a new session.createSession(String sessionId, Instant creationDate, Instant modificationDate, JsonObject attributes) Creates a session from infos, with existing attributes if any (nullotherwise)voidDeletes the current session in the request context, if any.voiddeleteOldInactiveSession(int sessionMaxInactiveMinutes) Deletes the deletes that were inactive for too long.voiddeleteSession(String sessionId) Deletes a saved session.voidDeletes the session id on the user.Generates a new session id.Gets the session of the current user, from the request context.getSavedSession(String sessionId) Gets a session from the database/data source.voidsaveSession(SpincastSession session) Save session.voidsaveSessionIdOnUser(String sessionId, boolean permanent) Will save the session id to the user (by default using a cookie).voidSaves a session, but update its modification date first.
-
Method Details
-
generateNewSessionId
String generateNewSessionId()Generates a new session id. -
createNewSession
SpincastSession createNewSession()Creates a new session. -
createSession
SpincastSession createSession(String sessionId, Instant creationDate, Instant modificationDate, JsonObject attributes) Creates a session from infos, with existing attributes if any (nullotherwise) -
getCurrentSession
SpincastSession getCurrentSession()Gets the session of the current user, from the request context. If not in a request context, returnsnull. -
getSavedSession
Gets a session from the database/data source.- Returns:
- the session or
nullif not found.
-
updateModificationDateAndSaveSession
Saves a session, but update its modification date first.The session to save must have a session id.
-
saveSession
Save session. -
deleteSession
Deletes a saved session. -
deleteCurrentSession
void deleteCurrentSession()Deletes the current session in the request context, if any. -
saveSessionIdOnUser
Will save the session id to the user (by default using a cookie).- Parameters:
permanent- iftrue, the session id will be kept when the browser session expires.
-
deleteSessionIdOnUser
void deleteSessionIdOnUser()Deletes the session id on the user. By default, will delete the session id cookie. -
deleteOldInactiveSession
void deleteOldInactiveSession(int sessionMaxInactiveMinutes) Deletes the deletes that were inactive for too long. This means their last "modification date" must be older than the specified number of mminutes.
-