Package ch.autumo.beetroot
Class SessionManager
java.lang.Object
ch.autumo.beetroot.SessionManager
User session manager.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidDestroy session, though not deleted in storage file!voiddestroyDelete(String token, org.nanohttpd.protocols.http.content.CookieHandler cookies) Destroy session and delete in storage file!findOrCreate(BeetRootHTTPSession session) Get an existing user session or create a new one if it doesn't exist for the nano cookie.static SessionManagerAccess session manager.protected longGet timeout in millis.static voidload()Load user sessions from file storage.static voidsave()Save user sessions to file storage.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Method Details
-
getInstance
Access session manager.- Returns:
- session manager
-
findOrCreate
Get an existing user session or create a new one if it doesn't exist for the nano cookie.- Parameters:
session- HTTP session- Returns:
- session user session
-
destroy
Destroy session, though not deleted in storage file!- Parameters:
token- token to destroycookies- nano cookie handler
-
destroyDelete
Destroy session and delete in storage file!- Parameters:
token- token to destroycookies- nano cookie handler
-
load
Load user sessions from file storage.- Throws:
Exception- exception
-
save
Save user sessions to file storage.- Throws:
Exception- exception
-
getSessionTimeoutInMillis
protected long getSessionTimeoutInMillis()Get timeout in millis.- Returns:
- timeout in millis
-