public class SpincastSessionManagerDefault extends Object implements SpincastSessionManager
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
static String |
REQUEST_CONTEXT_VARIABLE_SESSION
The name of the request context variable used to
save the user session.
|
| Constructor and Description |
|---|
SpincastSessionManagerDefault(SpincastSessionFactory spincastSessionFactory,
com.google.inject.Provider<RequestContext<?>> requestContextProvider,
JsonManager jsonManager,
SpincastSessionConfig spincastSessionConfig,
SpincastSessionRepository spincastSessionRepository) |
| Modifier and Type | Method and Description |
|---|---|
SpincastSession |
createNewSession()
Creates a new session.
|
SpincastSession |
createSession(String sessionId,
Instant creationDate,
Instant modificationDate,
JsonObject attributes)
Creates a session from infos, with existing
attributes if any (
null otherwise) |
void |
deleteCurrentSession()
Deletes the current session in the request
context, if any.
|
void |
deleteOldInactiveSession(int sessionMaxInactiveMinutes)
Deletes the deletes that were inactive for too long.
|
void |
deleteSession(String sessionId)
Deletes a saved session.
|
void |
deleteSessionIdOnUser()
Deletes the session id on the user.
|
String |
generateNewSessionId()
Generates a new session id.
|
SpincastSession |
getCurrentSession()
Gets the session of the current user, from the
request context.
|
protected JsonManager |
getJsonManager() |
protected com.google.inject.Provider<RequestContext<?>> |
getRequestContextProvider() |
SpincastSession |
getSavedSession(String sessionId)
Gets a session from the database/data source.
|
protected SpincastSessionConfig |
getSpincastSessionConfig() |
protected SpincastSessionFactory |
getSpincastSessionFactory() |
protected SpincastSessionRepository |
getSpincastSessionRepository() |
void |
saveSession(SpincastSession session)
Save session.
|
protected void |
saveSessionIdOnUser(RequestContext<?> context,
String sessionId,
boolean permanent) |
void |
saveSessionIdOnUser(String sessionId,
boolean permanent)
Will save the session id to the user (by default using
a cookie).
|
void |
updateModificationDateAndSaveSession(SpincastSession session)
Saves a session, but update its modification date first.
|
protected static final org.slf4j.Logger logger
public static final String REQUEST_CONTEXT_VARIABLE_SESSION
@Inject public SpincastSessionManagerDefault(SpincastSessionFactory spincastSessionFactory, com.google.inject.Provider<RequestContext<?>> requestContextProvider, JsonManager jsonManager, SpincastSessionConfig spincastSessionConfig, SpincastSessionRepository spincastSessionRepository)
protected SpincastSessionFactory getSpincastSessionFactory()
protected com.google.inject.Provider<RequestContext<?>> getRequestContextProvider()
protected JsonManager getJsonManager()
protected SpincastSessionConfig getSpincastSessionConfig()
protected SpincastSessionRepository getSpincastSessionRepository()
public SpincastSession createNewSession()
SpincastSessionManagercreateNewSession in interface SpincastSessionManagerpublic SpincastSession createSession(String sessionId, Instant creationDate, Instant modificationDate, JsonObject attributes)
SpincastSessionManagernull otherwise)createSession in interface SpincastSessionManagerpublic SpincastSession getCurrentSession()
SpincastSessionManagernull.getCurrentSession in interface SpincastSessionManagerpublic String generateNewSessionId()
SpincastSessionManagergenerateNewSessionId in interface SpincastSessionManagerpublic void deleteSessionIdOnUser()
SpincastSessionManagerdeleteSessionIdOnUser in interface SpincastSessionManagerpublic void saveSessionIdOnUser(String sessionId, boolean permanent)
SpincastSessionManagersaveSessionIdOnUser in interface SpincastSessionManagerpermanent - if true, the session id will be kept
when the browser session expires.protected void saveSessionIdOnUser(RequestContext<?> context, String sessionId, boolean permanent)
public final void updateModificationDateAndSaveSession(SpincastSession session)
SpincastSessionManagerThe session to save must have a session id.
updateModificationDateAndSaveSession in interface SpincastSessionManagerpublic void deleteCurrentSession()
SpincastSessionManagerdeleteCurrentSession in interface SpincastSessionManagerpublic SpincastSession getSavedSession(String sessionId)
SpincastSessionManagergetSavedSession in interface SpincastSessionManagernull if not found.public void saveSession(SpincastSession session)
SpincastSessionManagersaveSession in interface SpincastSessionManagerpublic void deleteSession(String sessionId)
SpincastSessionManagerdeleteSession in interface SpincastSessionManagerpublic void deleteOldInactiveSession(int sessionMaxInactiveMinutes)
SpincastSessionManagerdeleteOldInactiveSession in interface SpincastSessionManagerCopyright © 2018. All rights reserved.