|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.danube.http.session.SimpleCookieSessionManager
public class SimpleCookieSessionManager
Simple session manager implementation that uses cookies for storing session id on the client side. Sessions are not expired.
Field Summary | |
---|---|
static int |
DEFAULT_SESSION_TIMEOUT
Default session timeout as 30 minutes |
protected static Random |
random
Random number for creating session ids |
static String |
SESSION_ATTRIBUTE
Connection attribute name for session to be temporarely stored at |
static String |
SESSION_COOKIE_NAME
Default session cookie name |
protected String |
sessionCookieName
Name of session cookie. |
protected Map<Object,Session> |
sessions
Map of sessions |
Constructor Summary | |
---|---|
SimpleCookieSessionManager()
|
Method Summary | |
---|---|
protected Session |
createSession(String sessionId)
Creates new session object with given session id |
protected String |
createSessionId()
Creates session id |
Object |
findSession(HTTPConnection connection,
boolean create)
Finds a session for supplied connection |
Object |
findSession(Object sessionId,
boolean create)
Searches for the session using givne session id |
String |
getSessionCookieName()
Returns session's cookie name |
void |
removeSession(HTTPConnection connection)
Removes session from connection |
void |
removeSession(Object session)
This object removes existing session |
String |
rewriteURL(HTTPConnection connection,
String url)
Rewrites URL for given connection |
void |
setSessionCookieName(String sessionCookieName)
Sets session's cookie name |
protected String |
validateSessionId(String sessionId)
Validates session id. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SESSION_COOKIE_NAME
public static final String SESSION_ATTRIBUTE
public static final int DEFAULT_SESSION_TIMEOUT
protected Map<Object,Session> sessions
protected String sessionCookieName
SESSION_COOKIE_NAME
.
protected static Random random
Constructor Detail |
---|
public SimpleCookieSessionManager()
Method Detail |
---|
public Object findSession(HTTPConnection connection, boolean create)
findSession
in interface HTTPSessionManager
connection
- connectioncreate
- flag defining should session be created it doesn't exist already
true
or null
otherwise.public Object findSession(Object sessionId, boolean create)
findSession
in interface SessionManager
sessionId
- session id objectcreate
- flag defining should session be created it doesn't exist already
true
or null
otherwise.public void removeSession(HTTPConnection connection)
removeSession
in interface HTTPSessionManager
connection
- connectionpublic void removeSession(Object session)
removeSession
in interface SessionManager
session
- session to be removedpublic String rewriteURL(HTTPConnection connection, String url)
rewriteURL
in interface HTTPSessionManager
url
- URL to be rewrittenconnection
- http connection object
protected String validateSessionId(String sessionId)
sessionId
- session id
protected String createSessionId()
protected Session createSession(String sessionId)
sessionId
- session id
public String getSessionCookieName()
public void setSessionCookieName(String sessionCookieName)
sessionCookieName
- session's cookie name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |