|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.session.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 specialised version of the Session inner class that provides an attribute Map.
| 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. |
| Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
AbstractLifeCycle.AbstractLifeCycleListener |
| Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
|---|
LifeCycle.Listener |
| Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| Fields inherited from interface org.eclipse.jetty.server.SessionManager |
|---|
__CheckRemoteSessionEncoding, __DefaultSessionCookie, __DefaultSessionDomain, __DefaultSessionIdPathParameterName, __MaxAgeProperty, __SessionCookieProperty, __SessionDomainProperty, __SessionIdPathParameterNameProperty, __SessionPathProperty |
| Constructor Summary | |
|---|---|
AbstractSessionManager()
|
|
| Method Summary | |
|---|---|
HttpCookie |
access(HttpSession session,
boolean secure)
Called by the SessionHandler when a session is first accessed by a request. |
void |
addEventListener(java.util.EventListener listener)
Adds an event listener for session-related events. |
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()
Removes all event listeners for session-related events. |
void |
complete(HttpSession session)
Called by the SessionHandler when a session is last accessed by a request. |
void |
doStart()
|
void |
doStop()
|
java.lang.String |
getClusterId(HttpSession session)
|
java.util.Set<SessionTrackingMode> |
getDefaultSessionTrackingModes()
|
java.util.Set<SessionTrackingMode> |
getEffectiveSessionTrackingModes()
|
boolean |
getHttpOnly()
|
HttpSession |
getHttpSession(java.lang.String nodeId)
Returns the HttpSession with the given session id |
SessionIdManager |
getIdManager()
|
int |
getMaxInactiveInterval()
|
int |
getMaxSessions()
Deprecated. |
SessionIdManager |
getMetaManager()
Deprecated. use getIdManager() |
int |
getMinSessions()
Deprecated. always returns 0. no replacement available. |
java.lang.String |
getNodeId(HttpSession session)
|
int |
getRefreshCookieAge()
|
abstract AbstractSessionManager.Session |
getSession(java.lang.String idInCluster)
Get a known existing session |
HttpCookie |
getSessionCookie(HttpSession session,
java.lang.String contextPath,
boolean requestIsSecure)
Gets a Cookie for a session. |
SessionCookieConfig |
getSessionCookieConfig()
|
SessionHandler |
getSessionHandler()
|
java.lang.String |
getSessionIdPathParameterName()
|
java.lang.String |
getSessionIdPathParameterNamePrefix()
|
abstract java.util.Map |
getSessionMap()
Deprecated. Need to review if it is needed. |
int |
getSessions()
|
int |
getSessionsMax()
|
int |
getSessionsTotal()
|
long |
getSessionTimeMax()
|
double |
getSessionTimeMean()
|
double |
getSessionTimeStdDev()
|
long |
getSessionTimeTotal()
|
protected abstract void |
invalidateSessions()
|
boolean |
isCheckingRemoteSessionIdEncoding()
|
boolean |
isNodeIdInSessionId()
|
boolean |
isUsingCookies()
|
boolean |
isUsingURLs()
|
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(java.util.EventListener listener)
Removes an event listener for for session-related events. |
void |
removeSession(AbstractSessionManager.Session session,
boolean invalidate)
Remove session from manager |
void |
removeSession(HttpSession session,
boolean invalidate)
Remove session from manager |
protected abstract boolean |
removeSession(java.lang.String idInCluster)
|
void |
resetStats()
Deprecated. |
void |
setCheckingRemoteSessionIdEncoding(boolean remote)
|
void |
setHttpOnly(boolean httpOnly)
|
void |
setIdManager(SessionIdManager metaManager)
Sets the cross context session id manager |
void |
setMaxInactiveInterval(int seconds)
Sets the max period of inactivity, after which the session is invalidated, in seconds. |
void |
setNodeIdInSessionId(boolean nodeIdInSessionId)
|
void |
setRefreshCookieAge(int ageInSeconds)
|
void |
setSecureCookies(boolean secureCookies)
Set if the session manager should use SecureCookies. |
void |
setSessionCookie(java.lang.String cookieName)
|
void |
setSessionDomain(java.lang.String domain)
|
void |
setSessionHandler(SessionHandler sessionHandler)
Sets the SessionHandler. |
void |
setSessionIdPathParameterName(java.lang.String param)
Sets the session id URL path parameter name. |
void |
setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
|
void |
statsReset()
Reset statistics values |
| Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
addLifeCycleListener, getState, 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.eclipse.jetty.util.component.LifeCycle |
|---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| Field Detail |
|---|
public java.util.Set<SessionTrackingMode> __defaultSessionTrackingModes
public static final int __distantFuture
protected int _dftMaxIdleSecs
protected SessionHandler _sessionHandler
protected boolean _httpOnly
protected SessionIdManager _sessionIdManager
protected boolean _secureCookies
protected java.lang.Object _sessionAttributeListeners
protected java.lang.Object _sessionListeners
protected java.lang.ClassLoader _loader
protected ContextHandler.Context _context
protected java.lang.String _sessionCookie
protected java.lang.String _sessionIdPathParameterName
protected java.lang.String _sessionIdPathParameterNamePrefix
protected java.lang.String _sessionDomain
protected java.lang.String _sessionPath
protected int _maxCookieAge
protected int _refreshCookieAge
protected boolean _nodeIdInSessionId
protected boolean _checkingRemoteSessionIdEncoding
protected java.lang.String _sessionComment
public java.util.Set<SessionTrackingMode> _sessionTrackingModes
protected final CounterStatistic _sessionsStats
protected final SampleStatistic _sessionTimeStats
| Constructor Detail |
|---|
public AbstractSessionManager()
| Method Detail |
|---|
public HttpCookie access(HttpSession session,
boolean secure)
SessionManagerSessionHandler when a session is first accessed by a request.
access in interface SessionManagersession - the session objectsecure - whether the request is secure or not
SessionManager.complete(HttpSession)public void addEventListener(java.util.EventListener listener)
SessionManager
addEventListener in interface SessionManagerlistener - the session event listener to add
Individual SessionManagers implementations may accept arbitrary listener types,
but they are expected to at least handle HttpSessionActivationListener,
HttpSessionAttributeListener, HttpSessionBindingListener and HttpSessionListener.SessionManager.removeEventListener(EventListener)public void clearEventListeners()
SessionManager
clearEventListeners in interface SessionManagerSessionManager.removeEventListener(EventListener)public void complete(HttpSession session)
SessionManagerSessionHandler when a session is last accessed by a request.
complete in interface SessionManagersession - the session objectSessionManager.access(HttpSession, boolean)
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 SessionManagerHttpCookie.isHttpOnly()public HttpSession getHttpSession(java.lang.String nodeId)
SessionManagerHttpSession with the given session id
getHttpSession in interface SessionManagernodeId - the session id
HttpSession with the corresponding id or null if no session with the given id existspublic SessionIdManager getIdManager()
getIdManager in interface SessionManagerSessionManager.setIdManager(SessionIdManager)public int getMaxInactiveInterval()
getMaxInactiveInterval in interface SessionManagerSessionManager.setMaxInactiveInterval(int)@Deprecated public int getMaxSessions()
getSessionsMax()public int getSessionsMax()
public int getSessionsTotal()
@Deprecated public SessionIdManager getMetaManager()
getIdManager()
@Deprecated public int getMinSessions()
public int getRefreshCookieAge()
public HttpCookie getSessionCookie(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 SessionHandler getSessionHandler()
public abstract java.util.Map getSessionMap()
public int getSessions()
public java.lang.String getSessionIdPathParameterName()
getSessionIdPathParameterName in interface SessionManagerSessionManager.setSessionIdPathParameterName(String)public java.lang.String getSessionIdPathParameterNamePrefix()
getSessionIdPathParameterNamePrefix in interface SessionManagerSessionManager.getSessionIdPathParameterName(), by default
";" + sessionIdParameterName + "=", for easier lookup in URL strings.SessionManager.getSessionIdPathParameterName()public boolean isValid(HttpSession session)
isValid in interface SessionManagersession - the session to test for validity
public java.lang.String getClusterId(HttpSession session)
getClusterId in interface SessionManagersession - the session object
SessionManager.getNodeId(HttpSession)public java.lang.String getNodeId(HttpSession session)
getNodeId in interface SessionManagersession - the session object
SessionManager.getClusterId(HttpSession)public HttpSession newHttpSession(HttpServletRequest request)
newHttpSession in interface SessionManagerrequest - the HttpServletRequest containing the requested session id
HttpSessionpublic void removeEventListener(java.util.EventListener listener)
SessionManager
removeEventListener in interface SessionManagerlistener - the session event listener to removeSessionManager.addEventListener(EventListener)@Deprecated public void resetStats()
statsReset()public void statsReset()
public void setHttpOnly(boolean httpOnly)
httpOnly - The httpOnly to set.public void setIdManager(SessionIdManager metaManager)
SessionManager
setIdManager in interface SessionManagermetaManager - The metaManager used for cross context session management.SessionManager.getIdManager()public void setMaxInactiveInterval(int seconds)
SessionManager
setMaxInactiveInterval in interface SessionManagerseconds - SessionManager.getMaxInactiveInterval()public void setRefreshCookieAge(int ageInSeconds)
public void setSecureCookies(boolean secureCookies)
ServletRequest#isSecure() method must return true.
If SSL offload is used, then the AbstractConnector#customize(org.eclipse.jetty.io.EndPoint, Request)
method can be used to force the request to be https, or the {@link AbstractConnector#setForwarded(boolean)}
can be set to true, so that the X-Forwarded-Proto header is respected.
If secure session cookies are used, then a session may not be shared between http and https requests.
secureCookies - If true, use secure cookies.public void setSessionCookie(java.lang.String cookieName)
public void setSessionDomain(java.lang.String domain)
public void setSessionHandler(SessionHandler sessionHandler)
SessionManagerSessionHandler.
setSessionHandler in interface SessionManagersessionHandler - The sessionHandler to set.public void setSessionIdPathParameterName(java.lang.String param)
SessionManager
setSessionIdPathParameterName in interface SessionManagerparam - the URL path parameter name for session id URL rewriting (null or "none" for no rewriting).SessionManager.getSessionIdPathParameterName(),
SessionManager.getSessionIdPathParameterNamePrefix()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(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 boolean removeSession(java.lang.String idInCluster)
public long getSessionTimeMax()
public java.util.Set<SessionTrackingMode> getDefaultSessionTrackingModes()
getDefaultSessionTrackingModes in interface SessionManagerpublic java.util.Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
getEffectiveSessionTrackingModes in interface SessionManagerpublic void setSessionTrackingModes(java.util.Set<SessionTrackingMode> sessionTrackingModes)
setSessionTrackingModes in interface SessionManagerpublic boolean isUsingCookies()
isUsingCookies in interface SessionManagerpublic boolean isUsingURLs()
isUsingURLs in interface SessionManagerpublic SessionCookieConfig getSessionCookieConfig()
getSessionCookieConfig in interface SessionManagerpublic long getSessionTimeTotal()
public double getSessionTimeMean()
public double getSessionTimeStdDev()
public boolean isCheckingRemoteSessionIdEncoding()
isCheckingRemoteSessionIdEncoding in interface SessionManagerSessionManager.isCheckingRemoteSessionIdEncoding()public void setCheckingRemoteSessionIdEncoding(boolean remote)
setCheckingRemoteSessionIdEncoding in interface SessionManagerremote - True if absolute URLs are check for remoteness before being session encoded.SessionManager.setCheckingRemoteSessionIdEncoding(boolean)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||