|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mortbay.component.AbstractLifeCycle
org.mortbay.jetty.servlet.AbstractSessionManager
public abstract class AbstractSessionManager
An Abstract implementation of SessionManager. The partial implementation of SessionManager interface provides the majority of the handling required to implement a SessionManager. Concrete implementations of SessionManager based on AbstractSessionManager need only implement the newSession method to return a specialized version of the Session inner class that provides an attribute Map.
If the property org.mortbay.jetty.servlet.AbstractSessionManager.23Notifications is set to true, the 2.3 servlet spec notification style will be used.
| Nested Class Summary | |
|---|---|
static class |
AbstractSessionManager.NullSessionContext
Null returning implementation of HttpSessionContext |
class |
AbstractSessionManager.Session
Implements javax.servlet.HttpSession from the javax.servlet package. |
static interface |
AbstractSessionManager.SessionIf
Interface that any session wrapper should implement so that SessionManager may access the Jetty session implementation. |
| Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle |
|---|
LifeCycle.Listener |
| Field Summary | |
|---|---|
static int |
__distantFuture
|
protected ContextHandler.SContext |
_context
|
protected int |
_dftMaxIdleSecs
|
protected boolean |
_httpOnly
|
protected java.lang.ClassLoader |
_loader
|
protected int |
_maxCookieAge
|
protected int |
_maxSessions
|
protected int |
_minSessions
|
protected boolean |
_nodeIdInSessionId
|
protected int |
_refreshCookieAge
|
protected boolean |
_secureCookies
|
protected java.lang.Object |
_sessionAttributeListeners
|
protected java.lang.String |
_sessionCookie
|
protected java.lang.String |
_sessionDomain
|
protected SessionHandler |
_sessionHandler
|
protected SessionIdManager |
_sessionIdManager
|
protected java.lang.Object |
_sessionListeners
|
protected java.lang.String |
_sessionPath
|
protected java.lang.String |
_sessionURL
|
protected java.lang.String |
_sessionURLPrefix
|
| Fields inherited from class org.mortbay.component.AbstractLifeCycle |
|---|
_listeners |
| Fields inherited from interface org.mortbay.jetty.SessionManager |
|---|
__DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionURL, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionPathProperty, __SessionURLProperty |
| Constructor Summary | |
|---|---|
AbstractSessionManager()
|
|
| Method Summary | |
|---|---|
javax.servlet.http.Cookie |
access(javax.servlet.http.HttpSession session,
boolean secure)
Called by the SessionHandler when a session is access by a request |
void |
addEventListener(java.util.EventListener listener)
Add an event listener. |
protected abstract void |
addSession(AbstractSessionManager.Session session)
|
protected void |
addSession(AbstractSessionManager.Session session,
boolean created)
Add the session Registers the session with this manager and registers the session ID with the sessionIDManager; |
void |
clearEventListeners()
|
void |
complete(javax.servlet.http.HttpSession session)
Called by the SessionHandler when a reqeuest is not longer
handling a session. |
void |
doStart()
|
void |
doStop()
|
java.lang.String |
getClusterId(javax.servlet.http.HttpSession session)
Get the session cluster id |
boolean |
getHttpOnly()
|
javax.servlet.http.HttpSession |
getHttpSession(java.lang.String nodeId)
|
SessionIdManager |
getIdManager()
|
int |
getMaxCookieAge()
|
int |
getMaxInactiveInterval()
|
int |
getMaxSessions()
|
SessionIdManager |
getMetaManager()
Deprecated. use getIdManager() |
int |
getMinSessions()
|
java.lang.String |
getNodeId(javax.servlet.http.HttpSession session)
Get the session node id |
int |
getRefreshCookieAge()
|
boolean |
getSecureCookies()
|
abstract AbstractSessionManager.Session |
getSession(java.lang.String idInCluster)
Get a known existingsession |
java.lang.String |
getSessionCookie()
|
javax.servlet.http.Cookie |
getSessionCookie(javax.servlet.http.HttpSession session,
java.lang.String contextPath,
boolean requestIsSecure)
Get a Cookie for a session. |
java.lang.String |
getSessionDomain()
|
SessionHandler |
getSessionHandler()
|
abstract java.util.Map |
getSessionMap()
|
java.lang.String |
getSessionPath()
|
abstract int |
getSessions()
|
java.lang.String |
getSessionURL()
|
java.lang.String |
getSessionURLPrefix()
|
protected abstract void |
invalidateSessions()
|
boolean |
isNodeIdInSessionId()
|
boolean |
isUsingCookies()
|
boolean |
isValid(javax.servlet.http.HttpSession session)
|
javax.servlet.http.HttpSession |
newHttpSession(javax.servlet.http.HttpServletRequest request)
Create a new HttpSession for a request |
protected abstract AbstractSessionManager.Session |
newSession(javax.servlet.http.HttpServletRequest request)
Create a new session instance |
void |
removeEventListener(java.util.EventListener listener)
|
void |
removeSession(AbstractSessionManager.Session session,
boolean invalidate)
Remove session from manager |
void |
removeSession(javax.servlet.http.HttpSession session,
boolean invalidate)
Remove session from manager |
protected abstract void |
removeSession(java.lang.String idInCluster)
|
void |
resetStats()
|
void |
setHttpOnly(boolean httpOnly)
|
void |
setIdManager(SessionIdManager metaManager)
|
void |
setMaxCookieAge(int maxCookieAgeInSeconds)
|
void |
setMaxInactiveInterval(int seconds)
|
void |
setMetaManager(SessionIdManager metaManager)
Deprecated. use setIdManager(SessionIdManager) |
void |
setNodeIdInSessionId(boolean nodeIdInSessionId)
|
void |
setRefreshCookieAge(int ageInSeconds)
|
void |
setSecureCookies(boolean secureCookies)
|
void |
setSessionCookie(java.lang.String cookieName)
|
void |
setSessionDomain(java.lang.String domain)
|
void |
setSessionHandler(SessionHandler sessionHandler)
|
void |
setSessionPath(java.lang.String path)
|
void |
setSessionURL(java.lang.String param)
Set the session ID URL parameter name |
void |
setUsingCookies(boolean usingCookies)
|
| Methods inherited from class org.mortbay.component.AbstractLifeCycle |
|---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mortbay.component.LifeCycle |
|---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| Field Detail |
|---|
public static final int __distantFuture
protected int _dftMaxIdleSecs
protected SessionHandler _sessionHandler
protected boolean _httpOnly
protected int _maxSessions
protected int _minSessions
protected SessionIdManager _sessionIdManager
protected boolean _secureCookies
protected java.lang.Object _sessionAttributeListeners
protected java.lang.Object _sessionListeners
protected java.lang.ClassLoader _loader
protected ContextHandler.SContext _context
protected java.lang.String _sessionCookie
protected java.lang.String _sessionURL
protected java.lang.String _sessionURLPrefix
protected java.lang.String _sessionDomain
protected java.lang.String _sessionPath
protected int _maxCookieAge
protected int _refreshCookieAge
protected boolean _nodeIdInSessionId
| Constructor Detail |
|---|
public AbstractSessionManager()
| Method Detail |
|---|
public javax.servlet.http.Cookie access(javax.servlet.http.HttpSession session,
boolean secure)
SessionManagerSessionHandler when a session is access by a request
access in interface SessionManagerpublic void addEventListener(java.util.EventListener listener)
SessionManager
addEventListener in interface SessionManagerlistener - An Event Listener. Individual SessionManagers
implemetations may accept arbitrary listener types, but they
are expected to at least handle
HttpSessionActivationListener,
HttpSessionAttributeListener,
HttpSessionBindingListener,
HttpSessionListenerpublic void clearEventListeners()
clearEventListeners in interface SessionManagerpublic void complete(javax.servlet.http.HttpSession session)
SessionManagerSessionHandler when a reqeuest is not longer
handling a session. Not this includes new sessions, so there may not
be a matching call to #access(HttpSession).
complete in interface SessionManager
public void doStart()
throws java.lang.Exception
doStart in class AbstractLifeCyclejava.lang.Exception
public void doStop()
throws java.lang.Exception
doStop in class AbstractLifeCyclejava.lang.Exceptionpublic boolean getHttpOnly()
getHttpOnly in interface SessionManagerpublic javax.servlet.http.HttpSession getHttpSession(java.lang.String nodeId)
getHttpSession in interface SessionManagerpublic SessionIdManager getIdManager()
getIdManager in interface SessionManagerpublic int getMaxCookieAge()
getMaxCookieAge in interface SessionManagerpublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface SessionManagerpublic int getMaxSessions()
public SessionIdManager getMetaManager()
getIdManager()
getMetaManager in interface SessionManagerpublic int getMinSessions()
public int getRefreshCookieAge()
public boolean getSecureCookies()
getSecureCookies in interface SessionManagerpublic java.lang.String getSessionCookie()
getSessionCookie in interface SessionManager
public javax.servlet.http.Cookie getSessionCookie(javax.servlet.http.HttpSession session,
java.lang.String contextPath,
boolean requestIsSecure)
SessionManager
getSessionCookie in interface SessionManagersession - The session to which the cookie should refer.contextPath - The context to which the cookie should be linked. The client will only send the cookie value
when requesting resources under this path.requestIsSecure - Whether the client is accessing the server over a secure protocol (i.e. HTTPS).
SessionManager uses cookies, then this method will return a new
cookie object that should be set on the client in order to link future HTTP requests
with the session. If cookies are not in use, this method returns null.public java.lang.String getSessionDomain()
getSessionDomain in interface SessionManagerpublic SessionHandler getSessionHandler()
public abstract java.util.Map getSessionMap()
public java.lang.String getSessionPath()
getSessionPath in interface SessionManagerpublic abstract int getSessions()
public java.lang.String getSessionURL()
getSessionURL in interface SessionManagerpublic java.lang.String getSessionURLPrefix()
getSessionURLPrefix in interface SessionManagerpublic boolean isUsingCookies()
isUsingCookies in interface SessionManagerpublic boolean isValid(javax.servlet.http.HttpSession session)
isValid in interface SessionManagerpublic java.lang.String getClusterId(javax.servlet.http.HttpSession session)
SessionManager
getClusterId in interface SessionManagerpublic java.lang.String getNodeId(javax.servlet.http.HttpSession session)
SessionManager
getNodeId in interface SessionManagerpublic javax.servlet.http.HttpSession newHttpSession(javax.servlet.http.HttpServletRequest request)
newHttpSession in interface SessionManagerpublic void removeEventListener(java.util.EventListener listener)
removeEventListener in interface SessionManagerpublic void resetStats()
public void setHttpOnly(boolean httpOnly)
httpOnly - The httpOnly to set.public void setIdManager(SessionIdManager metaManager)
setIdManager in interface SessionManagermetaManager - The metaManager used for cross context session management.public void setMaxCookieAge(int maxCookieAgeInSeconds)
setMaxCookieAge in interface SessionManagerpublic void setMaxInactiveInterval(int seconds)
setMaxInactiveInterval in interface SessionManagerseconds - public void setMetaManager(SessionIdManager metaManager)
setIdManager(SessionIdManager)
public void setRefreshCookieAge(int ageInSeconds)
public void setSecureCookies(boolean secureCookies)
secureCookies - The secureCookies to set.public void setSessionCookie(java.lang.String cookieName)
setSessionCookie in interface SessionManagerpublic void setSessionDomain(java.lang.String domain)
setSessionDomain in interface SessionManagerpublic void setSessionHandler(SessionHandler sessionHandler)
setSessionHandler in interface SessionManagersessionHandler - The sessionHandler to set.public void setSessionPath(java.lang.String path)
setSessionPath in interface SessionManagerpublic void setSessionURL(java.lang.String param)
setSessionURL in interface SessionManagerparam - The parameter name for session id URL rewriting (null or "none" for no rewriting).public void setUsingCookies(boolean usingCookies)
usingCookies - The usingCookies to set.protected abstract void addSession(AbstractSessionManager.Session session)
protected void addSession(AbstractSessionManager.Session session,
boolean created)
public abstract AbstractSessionManager.Session getSession(java.lang.String idInCluster)
idInCluster - The session ID in the cluster, stripped of any worker name.
protected abstract void invalidateSessions()
protected abstract AbstractSessionManager.Session newSession(javax.servlet.http.HttpServletRequest request)
request -
public boolean isNodeIdInSessionId()
HttpSession.getId(). Default is false.public void setNodeIdInSessionId(boolean nodeIdInSessionId)
nodeIdInSessionId - true if the cluster node id (worker id) will be returned as part of the session id by HttpSession.getId(). Default is false.
public void removeSession(javax.servlet.http.HttpSession session,
boolean invalidate)
session - The session to removeinvalidate - True if HttpSessionListener.sessionDestroyed(HttpSessionEvent) and
SessionIdManager.invalidateAll(String) should be called.
public void removeSession(AbstractSessionManager.Session session,
boolean invalidate)
session - The session to removeinvalidate - True if HttpSessionListener.sessionDestroyed(HttpSessionEvent) and
SessionIdManager.invalidateAll(String) should be called.protected abstract void removeSession(java.lang.String idInCluster)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||