Class SpincastSessionRepositoryDefault
java.lang.Object
org.spincast.plugins.session.repositories.SpincastSessionRepositoryDefault
- All Implemented Interfaces:
SpincastSessionRepository
The default implementation of
SpincastSessionRepository
is to save the sessions in a cookie, on the user.
We highly suggest that you bind a custom implementation that saved sessions in a real database instead!
A cookie can contain +/- 4096 bytes maximum!
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSpincastSessionRepositoryDefault
(com.google.inject.Provider<RequestContext<?>> requestContextProvider, SpincastSessionConfig spincastSessionConfig, SpincastSessionFactory spincastSessionFactory, JsonManager jsonManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected SpincastSession
void
deleteOldInactiveSession
(int sessionMaxInactiveMinutes) Deletes the deletes that were inactive for too long.void
deleteSession
(String sessionId) Deletes a saved session.protected SpincastSession
deserializeSession
(String sessionValue) protected JsonManager
protected com.google.inject.Provider<RequestContext<?>>
getSession
(String sessionId) Gets a session from the database/data source.protected String
protected String
protected String
protected SpincastSessionConfig
protected SpincastSessionFactory
void
saveSession
(SpincastSession session) Save a session.protected String
serializeSession
(SpincastSession session)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
SpincastSessionRepositoryDefault
@Inject public SpincastSessionRepositoryDefault(com.google.inject.Provider<RequestContext<?>> requestContextProvider, SpincastSessionConfig spincastSessionConfig, SpincastSessionFactory spincastSessionFactory, JsonManager jsonManager)
-
-
Method Details
-
getRequestContextProvider
-
getSpincastSessionConfig
-
getSpincastSessionFactory
-
getJsonManager
-
getSession
Description copied from interface:SpincastSessionRepository
Gets a session from the database/data source.- Specified by:
getSession
in interfaceSpincastSessionRepository
- Returns:
- the session or
null
if not found.
-
saveSession
Description copied from interface:SpincastSessionRepository
Save a session.- Specified by:
saveSession
in interfaceSpincastSessionRepository
-
deleteSession
Description copied from interface:SpincastSessionRepository
Deletes a saved session.- Specified by:
deleteSession
in interfaceSpincastSessionRepository
-
deleteOldInactiveSession
public void deleteOldInactiveSession(int sessionMaxInactiveMinutes) Description copied from interface:SpincastSessionRepository
Deletes the deletes that were inactive for too long. This means their last "modification date" must be older than the specified number of mminutes.- Specified by:
deleteOldInactiveSession
in interfaceSpincastSessionRepository
-
serializeSession
-
deserializeSession
-
createNewSpincastSession
-
getSessionAttributeNameId
-
getSessionAttributeNameCreationDate
-
getSessionAttributeNameModificationDate
-