|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 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. |
Field Summary | |
---|---|
static int |
__distantFuture
|
protected ContextHandler.SContext |
_context
|
protected int |
_dftMaxIdleSecs
|
protected boolean |
_httpOnly
|
protected ClassLoader |
_loader
|
protected int |
_maxCookieAge
|
protected int |
_maxSessions
|
protected int |
_minSessions
|
protected boolean |
_nodeIdInSessionId
|
protected int |
_refreshCookieAge
|
protected boolean |
_secureCookies
|
protected Object |
_sessionAttributeListeners
|
protected String |
_sessionCookie
|
protected String |
_sessionDomain
|
protected SessionHandler |
_sessionHandler
|
protected SessionIdManager |
_sessionIdManager
|
protected Object |
_sessionListeners
|
protected String |
_sessionPath
|
protected String |
_sessionURL
|
protected String |
_sessionURLPrefix
|
Fields inherited from interface org.mortbay.jetty.SessionManager |
---|
__DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionURL, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionPathProperty, __SessionURLProperty |
Constructor Summary | |
---|---|
AbstractSessionManager()
|
Method Summary | |
---|---|
Cookie |
access(HttpSession session,
boolean secure)
Called by the SessionHandler when a session is access by a request |
void |
addEventListener(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(HttpSession session)
Called by the SessionHandler when a reqeuest is not longer
handling a session. |
void |
doStart()
|
void |
doStop()
|
String |
getClusterId(HttpSession session)
Get the session cluster id |
boolean |
getHttpOnly()
|
HttpSession |
getHttpSession(String nodeId)
|
SessionIdManager |
getIdManager()
|
int |
getMaxCookieAge()
|
int |
getMaxInactiveInterval()
|
int |
getMaxSessions()
|
SessionIdManager |
getMetaManager()
Deprecated. use getIdManager() |
int |
getMinSessions()
|
String |
getNodeId(HttpSession session)
Get the session node id |
int |
getRefreshCookieAge()
|
boolean |
getSecureCookies()
|
abstract AbstractSessionManager.Session |
getSession(String idInCluster)
Get a known existingsession |
String |
getSessionCookie()
|
Cookie |
getSessionCookie(HttpSession session,
String contextPath,
boolean requestIsSecure)
Get a Cookie for a session. |
String |
getSessionDomain()
|
SessionHandler |
getSessionHandler()
|
abstract Map |
getSessionMap()
|
String |
getSessionPath()
|
abstract int |
getSessions()
|
String |
getSessionURL()
|
String |
getSessionURLPrefix()
|
protected abstract void |
invalidateSessions()
|
boolean |
isNodeIdInSessionId()
|
boolean |
isUsingCookies()
|
boolean |
isValid(HttpSession session)
|
HttpSession |
newHttpSession(HttpServletRequest request)
Create a new HttpSession for a request |
protected abstract AbstractSessionManager.Session |
newSession(HttpServletRequest request)
Create a new session instance |
void |
removeEventListener(EventListener listener)
|
void |
removeSession(AbstractSessionManager.Session session,
boolean invalidate)
Remove session from manager |
void |
removeSession(HttpSession session,
boolean invalidate)
Remove session from manager |
protected abstract void |
removeSession(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(String cookieName)
|
void |
setSessionDomain(String domain)
|
void |
setSessionHandler(SessionHandler sessionHandler)
|
void |
setSessionPath(String path)
|
void |
setSessionURL(String url)
|
void |
setUsingCookies(boolean usingCookies)
|
Methods inherited from class org.mortbay.component.AbstractLifeCycle |
---|
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, 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 |
---|
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, 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 Object _sessionAttributeListeners
protected Object _sessionListeners
protected ClassLoader _loader
protected ContextHandler.SContext _context
protected String _sessionCookie
protected String _sessionURL
protected String _sessionURLPrefix
protected String _sessionDomain
protected String _sessionPath
protected int _maxCookieAge
protected int _refreshCookieAge
protected boolean _nodeIdInSessionId
Constructor Detail |
---|
public AbstractSessionManager()
Method Detail |
---|
public Cookie access(HttpSession session, boolean secure)
SessionManager
SessionHandler
when a session is access by a request
access
in interface SessionManager
public void addEventListener(EventListener listener)
SessionManager
addEventListener
in interface SessionManager
listener
- 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 SessionManager
public void complete(HttpSession session)
SessionManager
SessionHandler
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 Exception
doStart
in class AbstractLifeCycle
Exception
public void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public boolean getHttpOnly()
getHttpOnly
in interface SessionManager
public HttpSession getHttpSession(String nodeId)
getHttpSession
in interface SessionManager
public SessionIdManager getIdManager()
getIdManager
in interface SessionManager
public int getMaxCookieAge()
getMaxCookieAge
in interface SessionManager
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface SessionManager
public int getMaxSessions()
public SessionIdManager getMetaManager()
getIdManager()
getMetaManager
in interface SessionManager
public int getMinSessions()
public int getRefreshCookieAge()
public boolean getSecureCookies()
getSecureCookies
in interface SessionManager
public String getSessionCookie()
getSessionCookie
in interface SessionManager
public Cookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)
SessionManager
getSessionCookie
in interface SessionManager
session
- 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 String getSessionDomain()
getSessionDomain
in interface SessionManager
public SessionHandler getSessionHandler()
public abstract Map getSessionMap()
public String getSessionPath()
getSessionPath
in interface SessionManager
public abstract int getSessions()
public String getSessionURL()
getSessionURL
in interface SessionManager
public String getSessionURLPrefix()
getSessionURLPrefix
in interface SessionManager
public boolean isUsingCookies()
isUsingCookies
in interface SessionManager
public boolean isValid(HttpSession session)
isValid
in interface SessionManager
public String getClusterId(HttpSession session)
SessionManager
getClusterId
in interface SessionManager
public String getNodeId(HttpSession session)
SessionManager
getNodeId
in interface SessionManager
public HttpSession newHttpSession(HttpServletRequest request)
newHttpSession
in interface SessionManager
public void removeEventListener(EventListener listener)
removeEventListener
in interface SessionManager
public void resetStats()
public void setHttpOnly(boolean httpOnly)
httpOnly
- The httpOnly to set.public void setIdManager(SessionIdManager metaManager)
setIdManager
in interface SessionManager
metaManager
- The metaManager used for cross context session management.public void setMaxCookieAge(int maxCookieAgeInSeconds)
setMaxCookieAge
in interface SessionManager
public void setMaxInactiveInterval(int seconds)
setMaxInactiveInterval
in interface SessionManager
seconds
- 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(String cookieName)
setSessionCookie
in interface SessionManager
public void setSessionDomain(String domain)
setSessionDomain
in interface SessionManager
public void setSessionHandler(SessionHandler sessionHandler)
setSessionHandler
in interface SessionManager
sessionHandler
- The sessionHandler to set.public void setSessionPath(String path)
setSessionPath
in interface SessionManager
public void setSessionURL(String url)
setSessionURL
in interface SessionManager
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(String idInCluster)
idInCluster
- The session ID in the cluster, stripped of any worker name.
protected abstract void invalidateSessions()
protected abstract AbstractSessionManager.Session newSession(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(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(String idInCluster)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |