Top Description Inners Fields Constructors Methods
org.mortbay.jetty.servlet

public abstract Class AbstractSessionManager

extends AbstractLifeCycle
implements SessionManager
Class Inheritance
All Implemented Interfaces
org.mortbay.jetty.SessionManager, org.mortbay.component.LifeCycle
Known Direct Subclasses
org.mortbay.jetty.servlet.HashSessionManager, org.mortbay.jetty.servlet.JDBCSessionManager
Imports
java.io.Serializable, java.util.ArrayList, .Collections, .Enumeration, .EventListener, .Iterator, .List, .Map, javax.servlet.ServletContext, javax.servlet.http.Cookie, .HttpServletRequest, .HttpSession, .HttpSessionActivationListener, .HttpSessionAttributeListener, .HttpSessionBindingEvent, .HttpSessionBindingListener, .HttpSessionContext, .HttpSessionEvent, .HttpSessionListener, org.mortbay.component.AbstractLifeCycle, org.mortbay.jetty.Server, .SessionIdManager, .SessionManager, org.mortbay.jetty.handler.ContextHandler, org.mortbay.util.LazyList

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.

Author
Greg Wilkins (gregw)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AbstractSessionManager.NullSessionContext

Deprecated as a consequence of HttpSessionContext being deprecated.
Null returning implementation of HttpSessionContext
public abstract class
public static interface
AbstractSessionManager.SessionIf

Interface that any session wrapper should implement so that SessionManager may access the Jetty session implementation.

Field Summary

Modifier and TypeField and Description
public static final int
private static final HttpSessionContext
__nullSessionContext

Deprecated as a consequence of HttpSessionContext being deprecated.
protected ContextHandler.SContext
protected int
protected boolean
protected ClassLoader
protected int
protected int
protected int
protected boolean
protected int
protected boolean
protected Object
protected String
protected String
protected SessionHandler
protected SessionIdManager
protected String
protected String
protected Object
protected String
private boolean
Inherited from org.mortbay.component.AbstractLifeCycle:
_listeners

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Cookie
access(HttpSession
the session object
session
,
boolean
whether the request is secure or not
secure
)

Implements org.mortbay.jetty.SessionManager.access.

Called by the SessionHandler when a session is first accessed by a request.
public void
addEventListener(EventListener
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.
listener
)

Implements org.mortbay.jetty.SessionManager.addEventListener.

Adds an event listener for session-related events.
protected abstract void
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;

public void
clearEventListeners()

Implements org.mortbay.jetty.SessionManager.clearEventListeners.

Removes all event listeners for session-related events.
public void
complete(HttpSession
the session object
session
)

Implements org.mortbay.jetty.SessionManager.complete.

Called by the SessionHandler when a session is last accessed by a request.
public void
public void
public String
public boolean

Returns:

Returns the httpOnly.
getHttpOnly
()

Implements org.mortbay.jetty.SessionManager.getHttpOnly.

public HttpSession
getHttpSession(String
the session id
nodeId
)

Implements org.mortbay.jetty.SessionManager.getHttpSession.

Returns the HttpSession with the given session id
public SessionIdManager

Returns:

Returns the metaManager used for cross context session management
getIdManager
()

Implements org.mortbay.jetty.SessionManager.getIdManager.

public int
public int
public int
public SessionIdManager
public int
public String
public int
public boolean

Returns:

Returns the secureCookies.
getSecureCookies
()

Implements org.mortbay.jetty.SessionManager.getSecureCookies.

public abstract AbstractSessionManager.Session

Returns:

A Session or null if none exists.
getSession
(String
The session ID in the cluster, stripped of any worker name.
idInCluster
)

Get a known existingsession

public String
public Cookie
getSessionCookie(HttpSession
the session to which the cookie should refer.
session
,
String
the context to which the cookie should be linked. The client will only send the cookie value when requesting resources under this path.
contextPath
,
boolean
whether the client is accessing the server over a secure protocol (i.e. HTTPS).
requestIsSecure
)

Implements org.mortbay.jetty.SessionManager.getSessionCookie.

Gets a Cookie for a session.
public String
public SessionHandler

Returns:

Returns the sessionHandler.
getSessionHandler
()

public String
public String
public abstract Map<K, V>
getSessionMap()

Deprecated Need to review if it is needed.
public String
public abstract int
protected abstract void
public boolean

Returns:

true if the cluster node id (worker id) is returned as part of the session id by HttpSession#getId(). Default is false.
isNodeIdInSessionId
()

public boolean

Returns:

Returns the usingCookies.
isUsingCookies
()

Implements org.mortbay.jetty.SessionManager.isUsingCookies.

public boolean
isValid(HttpSession
the session to test for validity
session
)

Implements org.mortbay.jetty.SessionManager.isValid.

public HttpSession
newHttpSession(HttpServletRequest
the HttpServletRequest containing the requested session id
request
)

Implements org.mortbay.jetty.SessionManager.newHttpSession.

Create a new HttpSession for a request
protected abstract AbstractSessionManager.Session
newSession(HttpServletRequest request)

Create a new session instance

public void
removeEventListener(EventListener
the session event listener to remove
listener
)

Implements org.mortbay.jetty.SessionManager.removeEventListener.

Removes an event listener for for session-related events.
public void
removeSession(HttpSession
The session to remove
session
,
boolean invalidate)

Remove session from manager

public void
removeSession(AbstractSessionManager.Session
The session to remove
session
,
boolean invalidate)

Remove session from manager

protected abstract void
removeSession(String idInCluster)

public void
public void
setHttpOnly(boolean
The httpOnly to set.
httpOnly
)

public void
setIdManager(SessionIdManager
The metaManager used for cross context session management.
metaManager
)

Implements org.mortbay.jetty.SessionManager.setIdManager.

Sets the cross context session id manager
public void
setMaxCookieAge(int
the max age to set on the session cookie, in seconds
maxCookieAgeInSeconds
)

Implements org.mortbay.jetty.SessionManager.setMaxCookieAge.

Sets the max age to set on the session cookie, in seconds
public void
setMaxInactiveInterval(int seconds)

Implements org.mortbay.jetty.SessionManager.setMaxInactiveInterval.

Sets the max period of inactivity, after which the session is invalidated, in seconds.
public void
public void
setNodeIdInSessionId(boolean
true if the cluster node id (worker id) will be returned as part of the session id by HttpSession#getId(). Default is false.
nodeIdInSessionId
)

public void
setRefreshCookieAge(int ageInSeconds)

public void
setSecureCookies(boolean
The secureCookies to set.
secureCookies
)

public void
setSessionCookie(String
the session cookie name
cookieName
)

Implements org.mortbay.jetty.SessionManager.setSessionCookie.

Sets the session cookie name.
public void
setSessionDomain(String
the domain to set on the session cookie
domain
)

Implements org.mortbay.jetty.SessionManager.setSessionDomain.

Sets the domain to set on the session cookie
public void
setSessionHandler(SessionHandler
The sessionHandler to set.
sessionHandler
)

Implements org.mortbay.jetty.SessionManager.setSessionHandler.

Sets the SessionHandler.
public void
setSessionIdPathParameterName(String
the URL path parameter name for session id URL rewriting (null or "none" for no rewriting).
param
)

Implements org.mortbay.jetty.SessionManager.setSessionIdPathParameterName.

Sets the session id URL path parameter name.
public void
setSessionPath(String
the path to set on the session cookie
path
)

Implements org.mortbay.jetty.SessionManager.setSessionPath.

Sets the path to set on the session cookie
public void
setUsingCookies(boolean
The usingCookies to set.
usingCookies
)

Inherited from org.mortbay.component.AbstractLifeCycle:
addLifeCycleListenerisFailedisRunningisStartedisStartingisStoppedisStoppingremoveLifeCycleListenerstartstop