Top Description Fields Methods
org.mortbay.jetty

public Interface SessionManager

extends LifeCycle
Known Direct Implementers
org.mortbay.jetty.servlet.AbstractSessionManager
Imports
java.util.EventListener, javax.servlet.http.Cookie, .HttpServletRequest, .HttpSession, org.mortbay.component.LifeCycle, org.mortbay.jetty.servlet.SessionHandler

Session Manager. The API required to manage sessions for a servlet context.
Author
Greg Wilkins

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
public static final String
__MaxAgeProperty

Session Max Age.

public static final String
__SessionCookieProperty

Session cookie name.

public static final String
__SessionDomainProperty

Session Domain.

public static final String
__SessionPathProperty

Session Path.

public static final String
__SessionURLProperty

Session URL parameter name.

Method Summary

Modifier and TypeMethod and Description
public Cookie

Returns:

Cookie If non null, this cookie should be set on the response to either migrate the session or to refresh a cookie that may expire.
access
(HttpSession session, boolean secure)

Called by the SessionHandler when a session is access by a request

public void
addEventListener(EventListener
An Event Listener. Individual SessionManagers implemetations may accept arbitrary listener types, but they are expected to at least handle HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener, HttpSessionListener
listener
)

Add an event listener.

public void
public void
complete(HttpSession session)

Called by the SessionHandler when a reqeuest is not longer handling a session.

public String

Returns:

The unique id of the session within the cluster (without a node id extension)
getClusterId
(HttpSession session)

Get the session cluster id

public boolean

Returns:

true if session cookies should be httponly (microsoft extension)
getHttpOnly
()

public HttpSession
public SessionIdManager

Returns:

the cross context session meta manager.
getIdManager
()

public int
public int
public SessionIdManager

Returns:

the cross context session id manager.
getMetaManager
()

Deprecated use getIdManager()
public String

Returns:

The unique id of the session within the cluster, extended with an optional node id.
getNodeId
(HttpSession session)

Get the session node id

public boolean

Returns:

true if session cookies should be secure
getSecureCookies
()

public Cookie

Returns:

If this 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.
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
)

Get a Cookie for a session.

public String
public String
public String
public String
public String
public boolean
public boolean
public HttpSession
public void
public void
setIdManager(SessionIdManager
the cross context session meta manager.
meta
)

public void
setMaxCookieAge(int maxCookieAgeInSeconds)

public void
public void
public void
public void
public void
public void
Inherited from org.mortbay.component.LifeCycle:
addLifeCycleListenerisFailedisRunningisStartedisStartingisStoppedisStoppingremoveLifeCycleListenerstartstop

Field Detail

__DefaultSessionCookieback to summary
public static final String __DefaultSessionCookie
__DefaultSessionDomainback to summary
public static final String __DefaultSessionDomain
__DefaultSessionURLback to summary
public static final String __DefaultSessionURL
__MaxAgePropertyback to summary
public static final String __MaxAgeProperty

Session Max Age. If this property is set as a ServletContext InitParam, then it is used as the max age for the session cookie. If it is not set, then a max age of -1 is used.

__SessionCookiePropertyback to summary
public static final String __SessionCookieProperty

Session cookie name. Defaults to JSESSIONID, but can be set with the org.mortbay.jetty.servlet.SessionCookie context init parameter.

__SessionDomainPropertyback to summary
public static final String __SessionDomainProperty

Session Domain. If this property is set as a ServletContext InitParam, then it is used as the domain for session cookies. If it is not set, then no domain is specified for the session cookie.

__SessionPathPropertyback to summary
public static final String __SessionPathProperty

Session Path. If this property is set as a ServletContext InitParam, then it is used as the path for the session cookie. If it is not set, then the context path is used as the path for the cookie.

__SessionURLPropertyback to summary
public static final String __SessionURLProperty

Session URL parameter name. Defaults to jsessionid, but can be set with the org.mortbay.jetty.servlet.SessionURL context init parameter. If set to null or "none" no URL rewriting will be done.

Method Detail

accessback to summary
public Cookie access(HttpSession session, boolean secure)

Called by the SessionHandler when a session is access by a request

Returns:Cookie

Cookie If non null, this cookie should be set on the response to either migrate the session or to refresh a cookie that may expire.

addEventListenerback to summary
public void addEventListener(EventListener listener)

Add an event listener.

Parameters
listener:EventListener

An Event Listener. Individual SessionManagers implemetations may accept arbitrary listener types, but they are expected to at least handle HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener, HttpSessionListener

clearEventListenersback to summary
public void clearEventListeners()
completeback to summary
public void complete(HttpSession session)

Called by the 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).

getClusterIdback to summary
public String getClusterId(HttpSession session)

Get the session cluster id

Returns:String

The unique id of the session within the cluster (without a node id extension)

getHttpOnlyback to summary
public boolean getHttpOnly()
Returns:boolean

true if session cookies should be httponly (microsoft extension)

getHttpSessionback to summary
public HttpSession getHttpSession(String id)
getIdManagerback to summary
public SessionIdManager getIdManager()
Returns:SessionIdManager

the cross context session meta manager.

getMaxCookieAgeback to summary
public int getMaxCookieAge()
getMaxInactiveIntervalback to summary
public int getMaxInactiveInterval()
getMetaManagerback to summary
public SessionIdManager getMetaManager()

Deprecated

use getIdManager()

Returns:SessionIdManager

the cross context session id manager.

getNodeIdback to summary
public String getNodeId(HttpSession session)

Get the session node id

Returns:String

The unique id of the session within the cluster, extended with an optional node id.

getSecureCookiesback to summary
public boolean getSecureCookies()
Returns:boolean

true if session cookies should be secure

getSessionCookieback to summary
public Cookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)

Get a Cookie for a session.

Parameters
session:HttpSession

The session to which the cookie should refer.

contextPath:String

The context to which the cookie should be linked. The client will only send the cookie value when requesting resources under this path.

requestIsSecure:boolean

Whether the client is accessing the server over a secure protocol (i.e. HTTPS).

Returns:Cookie

If this 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.

getSessionCookieback to summary
public String getSessionCookie()
getSessionDomainback to summary
public String getSessionDomain()
getSessionPathback to summary
public String getSessionPath()
getSessionURLback to summary
public String getSessionURL()
getSessionURLPrefixback to summary
public String getSessionURLPrefix()
isUsingCookiesback to summary
public boolean isUsingCookies()
isValidback to summary
public boolean isValid(HttpSession session)
newHttpSessionback to summary
public HttpSession newHttpSession(HttpServletRequest request)
removeEventListenerback to summary
public void removeEventListener(EventListener listener)
setIdManagerback to summary
public void setIdManager(SessionIdManager meta)
Parameters
meta:SessionIdManager

the cross context session meta manager.

setMaxCookieAgeback to summary
public void setMaxCookieAge(int maxCookieAgeInSeconds)
setMaxInactiveIntervalback to summary
public void setMaxInactiveInterval(int seconds)
setSessionCookieback to summary
public void setSessionCookie(String cookieName)
setSessionDomainback to summary
public void setSessionDomain(String domain)
setSessionHandlerback to summary
public void setSessionHandler(SessionHandler handler)
setSessionPathback to summary
public void setSessionPath(String path)
setSessionURLback to summary
public void setSessionURL(String url)