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

Field Detail

__distantFutureback to summary
public static final int __distantFuture
__nullSessionContextback to summary
private static final HttpSessionContext __nullSessionContext

Deprecated

as a consequence of HttpSessionContext being deprecated. See corresponding docs for further information.

_contextback to summary
protected ContextHandler.SContext _context
_dftMaxIdleSecsback to summary
protected int _dftMaxIdleSecs
_httpOnlyback to summary
protected boolean _httpOnly
_loaderback to summary
protected ClassLoader _loader
_maxCookieAgeback to summary
protected int _maxCookieAge
_maxSessionsback to summary
protected int _maxSessions
_minSessionsback to summary
protected int _minSessions
_nodeIdInSessionIdback to summary
protected boolean _nodeIdInSessionId
_refreshCookieAgeback to summary
protected int _refreshCookieAge
_secureCookiesback to summary
protected boolean _secureCookies
_sessionAttributeListenersback to summary
protected Object _sessionAttributeListeners
_sessionCookieback to summary
protected String _sessionCookie
_sessionDomainback to summary
protected String _sessionDomain
_sessionHandlerback to summary
protected SessionHandler _sessionHandler
_sessionIdManagerback to summary
protected SessionIdManager _sessionIdManager
_sessionIdPathParameterNameback to summary
protected String _sessionIdPathParameterName
_sessionIdPathParameterNamePrefixback to summary
protected String _sessionIdPathParameterNamePrefix
_sessionListenersback to summary
protected Object _sessionListeners
_sessionPathback to summary
protected String _sessionPath
_usingCookiesback to summary
private boolean _usingCookies

Constructor Detail

AbstractSessionManagerback to summary
public AbstractSessionManager()

Method Detail

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

Implements org.mortbay.jetty.SessionManager.access.

Doc from org.mortbay.jetty.SessionManager.access.

Called by the SessionHandler when a session is first accessed by a request.

Parameters
session:HttpSession

the session object

secure:boolean

whether the request is secure or not

Returns:Cookie

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

addEventListenerback to summary
public void addEventListener(EventListener listener)

Implements org.mortbay.jetty.SessionManager.addEventListener.

Doc from org.mortbay.jetty.SessionManager.addEventListener.

Adds an event listener for session-related events.

Parameters
listener: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.

addSessionback to summary
protected abstract void addSession(AbstractSessionManager.Session session)
addSessionback to summary
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;

clearEventListenersback to summary
public void clearEventListeners()

Implements org.mortbay.jetty.SessionManager.clearEventListeners.

Doc from org.mortbay.jetty.SessionManager.clearEventListeners.

Removes all event listeners for session-related events.

completeback to summary
public void complete(HttpSession session)

Implements org.mortbay.jetty.SessionManager.complete.

Doc from org.mortbay.jetty.SessionManager.complete.

Called by the SessionHandler when a session is last accessed by a request.

Parameters
session:HttpSession

the session object

doStartback to summary
public void doStart() throws Exception

Overrides org.mortbay.component.AbstractLifeCycle.doStart.

doStopback to summary
public void doStop() throws Exception

Overrides org.mortbay.component.AbstractLifeCycle.doStop.

getClusterIdback to summary
public String getClusterId(HttpSession session)

Implements org.mortbay.jetty.SessionManager.getClusterId.

Parameters
session:HttpSession

Doc from org.mortbay.jetty.SessionManager.getClusterId.

the session object

Returns:String

Doc from org.mortbay.jetty.SessionManager.getClusterId.

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

getHttpOnlyback to summary
public boolean getHttpOnly()

Implements org.mortbay.jetty.SessionManager.getHttpOnly.

Returns:boolean

Returns the httpOnly.

getHttpSessionback to summary
public HttpSession getHttpSession(String nodeId)

Implements org.mortbay.jetty.SessionManager.getHttpSession.

Doc from org.mortbay.jetty.SessionManager.getHttpSession.

Returns the HttpSession with the given session id

Parameters
nodeId:String

the session id

Returns:HttpSession

the HttpSession with the corresponding id or null if no session with the given id exists

getIdManagerback to summary
public SessionIdManager getIdManager()

Implements org.mortbay.jetty.SessionManager.getIdManager.

Returns:SessionIdManager

Returns the metaManager used for cross context session management

getMaxCookieAgeback to summary
public int getMaxCookieAge()

Implements org.mortbay.jetty.SessionManager.getMaxCookieAge.

Returns:int

Doc from org.mortbay.jetty.SessionManager.getMaxCookieAge.

the max age to set on the session cookie, in seconds

getMaxInactiveIntervalback to summary
public int getMaxInactiveInterval()

Implements org.mortbay.jetty.SessionManager.getMaxInactiveInterval.

Returns:int

seconds

getMaxSessionsback to summary
public int getMaxSessions()
getMetaManagerback to summary
public SessionIdManager getMetaManager()

Implements org.mortbay.jetty.SessionManager.getMetaManager.

Deprecated

use getIdManager()

Returns:SessionIdManager

Doc from org.mortbay.jetty.SessionManager.getMetaManager.

the cross context session id manager.

getMinSessionsback to summary
public int getMinSessions()
getNodeIdback to summary
public String getNodeId(HttpSession session)

Implements org.mortbay.jetty.SessionManager.getNodeId.

Parameters
session:HttpSession

Doc from org.mortbay.jetty.SessionManager.getNodeId.

the session object

Returns:String

Doc from org.mortbay.jetty.SessionManager.getNodeId.

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

getRefreshCookieAgeback to summary
public int getRefreshCookieAge()
getSecureCookiesback to summary
public boolean getSecureCookies()

Implements org.mortbay.jetty.SessionManager.getSecureCookies.

Returns:boolean

Returns the secureCookies.

getSessionback to summary
public abstract AbstractSessionManager.Session getSession(String idInCluster)

Get a known existingsession

Parameters
idInCluster:String

The session ID in the cluster, stripped of any worker name.

Returns:AbstractSessionManager.Session

A Session or null if none exists.

getSessionCookieback to summary
public String getSessionCookie()

Implements org.mortbay.jetty.SessionManager.getSessionCookie.

Returns:String

Doc from org.mortbay.jetty.SessionManager.getSessionCookie.

the session cookie name, by default "JSESSIONID".

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

Implements org.mortbay.jetty.SessionManager.getSessionCookie.

Doc from org.mortbay.jetty.SessionManager.getSessionCookie.

Gets 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.

getSessionDomainback to summary
public String getSessionDomain()

Implements org.mortbay.jetty.SessionManager.getSessionDomain.

Returns:String

Doc from org.mortbay.jetty.SessionManager.getSessionDomain.

the domain to set on the session cookie

getSessionHandlerback to summary
public SessionHandler getSessionHandler()
Returns:SessionHandler

Returns the sessionHandler.

getSessionIdPathParameterNameback to summary
public String getSessionIdPathParameterName()

Implements org.mortbay.jetty.SessionManager.getSessionIdPathParameterName.

Returns:String

Doc from org.mortbay.jetty.SessionManager.getSessionIdPathParameterName.

the URL path parameter name for session id URL rewriting, by default "jsessionid".

getSessionIdPathParameterNamePrefixback to summary
public String getSessionIdPathParameterNamePrefix()

Implements org.mortbay.jetty.SessionManager.getSessionIdPathParameterNamePrefix.

Returns:String

Doc from org.mortbay.jetty.SessionManager.getSessionIdPathParameterNamePrefix.

a formatted version of getSessionIdPathParameterName(), by default ";" + sessionIdParameterName + "=", for easier lookup in URL strings.

getSessionMapback to summary
public abstract Map<K, V> getSessionMap()

Deprecated

Need to review if it is needed.

getSessionPathback to summary
public String getSessionPath()

Implements org.mortbay.jetty.SessionManager.getSessionPath.

Returns:String

Doc from org.mortbay.jetty.SessionManager.getSessionPath.

the path to set on the session cookie

getSessionsback to summary
public abstract int getSessions()
invalidateSessionsback to summary
protected abstract void invalidateSessions()
isNodeIdInSessionIdback to summary
public boolean isNodeIdInSessionId()
Returns:boolean

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

isUsingCookiesback to summary
public boolean isUsingCookies()

Implements org.mortbay.jetty.SessionManager.isUsingCookies.

Returns:boolean

Returns the usingCookies.

isValidback to summary
public boolean isValid(HttpSession session)

Implements org.mortbay.jetty.SessionManager.isValid.

Parameters
session:HttpSession

Doc from org.mortbay.jetty.SessionManager.isValid.

the session to test for validity

Returns:boolean

Doc from org.mortbay.jetty.SessionManager.isValid.

whether the given session is valid, that is, it has not been invalidated.

newHttpSessionback to summary
public HttpSession newHttpSession(HttpServletRequest request)

Implements org.mortbay.jetty.SessionManager.newHttpSession.

Create a new HttpSession for a request

Parameters
request:HttpServletRequest

Doc from org.mortbay.jetty.SessionManager.newHttpSession.

the HttpServletRequest containing the requested session id

Returns:HttpSession

Doc from org.mortbay.jetty.SessionManager.newHttpSession.

the new HttpSession

newSessionback to summary
protected abstract AbstractSessionManager.Session newSession(HttpServletRequest request)

Create a new session instance

removeEventListenerback to summary
public void removeEventListener(EventListener listener)

Implements org.mortbay.jetty.SessionManager.removeEventListener.

Doc from org.mortbay.jetty.SessionManager.removeEventListener.

Removes an event listener for for session-related events.

Parameters
listener:EventListener

the session event listener to remove

removeSessionback to summary
public void removeSession(HttpSession session, boolean invalidate)

Remove session from manager

Parameters
session:HttpSession

The session to remove

invalidate:boolean

True if HttpSessionListener#sessionDestroyed(HttpSessionEvent) and SessionIdManager#invalidateAll(String) should be called.

removeSessionback to summary
public void removeSession(AbstractSessionManager.Session session, boolean invalidate)

Remove session from manager

Parameters
session:AbstractSessionManager.Session

The session to remove

invalidate:boolean

True if HttpSessionListener#sessionDestroyed(HttpSessionEvent) and SessionIdManager#invalidateAll(String) should be called.

removeSessionback to summary
protected abstract void removeSession(String idInCluster)
resetStatsback to summary
public void resetStats()
setHttpOnlyback to summary
public void setHttpOnly(boolean httpOnly)
Parameters
httpOnly:boolean

The httpOnly to set.

setIdManagerback to summary
public void setIdManager(SessionIdManager metaManager)

Implements org.mortbay.jetty.SessionManager.setIdManager.

Doc from org.mortbay.jetty.SessionManager.setIdManager.

Sets the cross context session id manager

Parameters
metaManager:SessionIdManager

The metaManager used for cross context session management.

setMaxCookieAgeback to summary
public void setMaxCookieAge(int maxCookieAgeInSeconds)

Implements org.mortbay.jetty.SessionManager.setMaxCookieAge.

Doc from org.mortbay.jetty.SessionManager.setMaxCookieAge.

Sets the max age to set on the session cookie, in seconds

Parameters
maxCookieAgeInSeconds:int

the max age to set on the session cookie, in seconds

setMaxInactiveIntervalback to summary
public void setMaxInactiveInterval(int seconds)

Implements org.mortbay.jetty.SessionManager.setMaxInactiveInterval.

Doc from org.mortbay.jetty.SessionManager.setMaxInactiveInterval.

Sets the max period of inactivity, after which the session is invalidated, in seconds.

setMetaManagerback to summary
public void setMetaManager(SessionIdManager metaManager)
setNodeIdInSessionIdback to summary
public void setNodeIdInSessionId(boolean nodeIdInSessionId)
Parameters
nodeIdInSessionId:boolean

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

setRefreshCookieAgeback to summary
public void setRefreshCookieAge(int ageInSeconds)
setSecureCookiesback to summary
public void setSecureCookies(boolean secureCookies)
Parameters
secureCookies:boolean

The secureCookies to set.

setSessionCookieback to summary
public void setSessionCookie(String cookieName)

Implements org.mortbay.jetty.SessionManager.setSessionCookie.

Doc from org.mortbay.jetty.SessionManager.setSessionCookie.

Sets the session cookie name.

Parameters
cookieName:String

the session cookie name

setSessionDomainback to summary
public void setSessionDomain(String domain)

Implements org.mortbay.jetty.SessionManager.setSessionDomain.

Doc from org.mortbay.jetty.SessionManager.setSessionDomain.

Sets the domain to set on the session cookie

Parameters
domain:String

the domain to set on the session cookie

setSessionHandlerback to summary
public void setSessionHandler(SessionHandler sessionHandler)

Implements org.mortbay.jetty.SessionManager.setSessionHandler.

Doc from org.mortbay.jetty.SessionManager.setSessionHandler.

Sets the SessionHandler.

Parameters
sessionHandler:SessionHandler

The sessionHandler to set.

setSessionIdPathParameterNameback to summary
public void setSessionIdPathParameterName(String param)

Implements org.mortbay.jetty.SessionManager.setSessionIdPathParameterName.

Doc from org.mortbay.jetty.SessionManager.setSessionIdPathParameterName.

Sets the session id URL path parameter name.

Parameters
param:String

the URL path parameter name for session id URL rewriting (null or "none" for no rewriting).

setSessionPathback to summary
public void setSessionPath(String path)

Implements org.mortbay.jetty.SessionManager.setSessionPath.

Doc from org.mortbay.jetty.SessionManager.setSessionPath.

Sets the path to set on the session cookie

Parameters
path:String

the path to set on the session cookie

setUsingCookiesback to summary
public void setUsingCookies(boolean usingCookies)
Parameters
usingCookies:boolean

The usingCookies to set.

org.mortbay.jetty.servlet back to summary

public Class AbstractSessionManager.NullSessionContext

extends Object
implements HttpSessionContext
Class Inheritance
  • java.lang.Object
  • org.mortbay.jetty.servlet.AbstractSessionManager.NullSessionContext
All Implemented Interfaces
javax.servlet.http.HttpSessionContext

Deprecated

as a consequence of HttpSessionContext being deprecated. See corresponding docs for further information.

Null returning implementation of HttpSessionContext
Author
Greg Wilkins (gregw)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Enumeration<E>
getIds()

Implements javax.servlet.http.HttpSessionContext.getIds.

Deprecated From HttpSessionContext
public HttpSession
getSession(String
the id of the session to be returned
id
)

Implements javax.servlet.http.HttpSessionContext.getSession.

Deprecated From HttpSessionContext
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

NullSessionContextback to summary
private NullSessionContext()

Method Detail

getIdsback to summary
public Enumeration<E> getIds()

Implements javax.servlet.http.HttpSessionContext.getIds.

Deprecated

From HttpSessionContext

Returns:Enumeration<E>

Doc from javax.servlet.http.HttpSessionContext.getIds.

null

getSessionback to summary
public HttpSession getSession(String id)

Implements javax.servlet.http.HttpSessionContext.getSession.

Deprecated

From HttpSessionContext

Parameters
id:String

Doc from javax.servlet.http.HttpSessionContext.getSession.

the id of the session to be returned

Returns:HttpSession

Doc from javax.servlet.http.HttpSessionContext.getSession.

null in all cases

org.mortbay.jetty.servlet back to summary

public abstract Class AbstractSessionManager.Session

extends Object
implements SessionIf, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.mortbay.jetty.servlet.AbstractSessionManager.SessionIf, javax.servlet.http.HttpSession
Known Direct Subclasses
org.mortbay.jetty.servlet.HashSessionManager.Session, org.mortbay.jetty.servlet.JDBCSessionManager.Session

Implements javax.servlet.HttpSession from the javax.servlet package.

Author
gregw

Field Summary

Modifier and TypeField and Description
protected long
protected final String
protected long
protected final long
protected boolean
protected boolean
protected boolean
protected long
protected long
protected boolean
protected final String
protected int
protected Map<K, V>

Constructor Summary

AccessConstructor and Description
protected
protected
Session(long created, String clusterId)

Method Summary

Modifier and TypeMethod and Description
protected void
access(long time)

protected void
bindValue(String name, Object value)

If value implements HttpSessionBindingListener, call valueBound()

protected void
protected void
protected void
protected void
public Object
getAttribute(String
a string specifying the name of the object
name
)

Implements javax.servlet.http.HttpSession.getAttribute.

Returns the object bound with the specified name in this session, or null if no object is bound under the name.
public Enumeration<E>
getAttributeNames()

Implements javax.servlet.http.HttpSession.getAttributeNames.

Returns an Enumeration of String objects containing the names of all the objects bound to this session.
protected String
public long
public long
getCreationTime()

Implements javax.servlet.http.HttpSession.getCreationTime.

Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
public String
getId()

Implements javax.servlet.http.HttpSession.getId.

Returns a string containing the unique identifier assigned to this session.
public long
getLastAccessedTime()

Implements javax.servlet.http.HttpSession.getLastAccessedTime.

Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.
public int
getMaxInactiveInterval()

Implements javax.servlet.http.HttpSession.getMaxInactiveInterval.

Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.
protected String
public ServletContext
getServletContext()

Implements javax.servlet.http.HttpSession.getServletContext.

Returns the ServletContext to which this session belongs.
public AbstractSessionManager.Session
public HttpSessionContext
public Object
getValue(String
a string specifying the name of the object
name
)

Implements javax.servlet.http.HttpSession.getValue.

Deprecated As of Version 2.2, this method is replaced by getAttribute
public String[]
getValueNames()

Implements javax.servlet.http.HttpSession.getValueNames.

Deprecated As of Version 2.2, this method is replaced by getAttributeNames
protected void
public void
invalidate()

Implements javax.servlet.http.HttpSession.invalidate.

Invalidates this session then unbinds any objects bound to it.
public boolean
public boolean
isNew()

Implements javax.servlet.http.HttpSession.isNew.

Returns true if the client does not yet know about the session or if the client chooses not to join the session.
protected boolean
protected abstract Map<K, V>
public void
putValue(String
the name to which the object is bound; cannot be null
name
,
Object
the object to be bound; cannot be null
value
)

Implements javax.servlet.http.HttpSession.putValue.

Deprecated As of Version 2.2, this method is replaced by setAttribute
public void
removeAttribute(String
the name of the object to remove from this session
name
)

Implements javax.servlet.http.HttpSession.removeAttribute.

Removes the object bound with the specified name from this session.
public void
removeValue(String
the name of the object to remove from this session
name
)

Implements javax.servlet.http.HttpSession.removeValue.

Deprecated As of Version 2.2, this method is replaced by removeAttribute
public void
setAttribute(String
the name to which the object is bound; cannot be null
name
,
Object
the object to be bound
value
)

Implements javax.servlet.http.HttpSession.setAttribute.

Binds an object to this session, using the name specified.
public void
setIdChanged(boolean changed)

public void
setMaxInactiveInterval(int
An integer specifying the number of seconds
secs
)

Implements javax.servlet.http.HttpSession.setMaxInactiveInterval.

Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
protected void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
protected void
unbindValue(String name, Object value)

If value implements HttpSessionBindingListener, call valueUnbound()

protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_accessedback to summary
protected long _accessed
_clusterIdback to summary
protected final String _clusterId
_cookieSetback to summary
protected long _cookieSet
_createdback to summary
protected final long _created
_doInvalidateback to summary
protected boolean _doInvalidate
_idChangedback to summary
protected boolean _idChanged
_invalidback to summary
protected boolean _invalid
_lastAccessedback to summary
protected long _lastAccessed
_maxIdleMsback to summary
protected long _maxIdleMs
_newSessionback to summary
protected boolean _newSession
_nodeIdback to summary
protected final String _nodeId
_requestsback to summary
protected int _requests
_valuesback to summary
protected Map<K, V> _values

Constructor Detail

Sessionback to summary
protected Session(HttpServletRequest request)
Sessionback to summary
protected Session(long created, String clusterId)

Method Detail

accessback to summary
protected void access(long time)
bindValueback to summary
protected void bindValue(String name, Object value)

If value implements HttpSessionBindingListener, call valueBound()

completeback to summary
protected void complete()
cookieSetback to summary
protected void cookieSet()
didActivateback to summary
protected void didActivate()
doInvalidateback to summary
protected void doInvalidate() throws IllegalStateException
getAttributeback to summary
public Object getAttribute(String name)

Implements javax.servlet.http.HttpSession.getAttribute.

Doc from javax.servlet.http.HttpSession.getAttribute.

Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Parameters
name:String

a string specifying the name of the object

Returns:Object

the object with the specified name

getAttributeNamesback to summary
public Enumeration<E> getAttributeNames()

Implements javax.servlet.http.HttpSession.getAttributeNames.

Doc from javax.servlet.http.HttpSession.getAttributeNames.

Returns an Enumeration of String objects containing the names of all the objects bound to this session.

Returns:Enumeration<E>

an Enumeration of String objects specifying the names of all the objects bound to this session

getClusterIdback to summary
protected String getClusterId()
getCookieSetTimeback to summary
public long getCookieSetTime()
getCreationTimeback to summary
public long getCreationTime() throws IllegalStateException

Implements javax.servlet.http.HttpSession.getCreationTime.

Doc from javax.servlet.http.HttpSession.getCreationTime.

Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.

Returns:long

a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT

Exceptions
IllegalStateException:
if this method is called on an invalidated session
getIdback to summary
public String getId() throws IllegalStateException

Implements javax.servlet.http.HttpSession.getId.

Doc from javax.servlet.http.HttpSession.getId.

Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.

Returns:String

a string specifying the identifier assigned to this session

getLastAccessedTimeback to summary
public long getLastAccessedTime() throws IllegalStateException

Implements javax.servlet.http.HttpSession.getLastAccessedTime.

Doc from javax.servlet.http.HttpSession.getLastAccessedTime.

Returns the last time the client sent a request associated with this session, as the number of milliseconds since midnight January 1, 1970 GMT, and marked by the time the container received the request.

Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

Returns:long

a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT

Exceptions
IllegalStateException:
if this method is called on an invalidated session
getMaxInactiveIntervalback to summary
public int getMaxInactiveInterval()

Implements javax.servlet.http.HttpSession.getMaxInactiveInterval.

Doc from javax.servlet.http.HttpSession.getMaxInactiveInterval.

Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method.

A return value of zero or less indicates that the session will never timeout.

Returns:int

an integer specifying the number of seconds this session remains open between client requests

getNodeIdback to summary
protected String getNodeId()
getServletContextback to summary
public ServletContext getServletContext()

Implements javax.servlet.http.HttpSession.getServletContext.

Doc from javax.servlet.http.HttpSession.getServletContext.

Returns the ServletContext to which this session belongs.

Returns:ServletContext

The ServletContext object for the web application

getSessionback to summary
public AbstractSessionManager.Session getSession()

Implements org.mortbay.jetty.servlet.AbstractSessionManager.SessionIf.getSession.

getSessionContextback to summary
public HttpSessionContext getSessionContext() throws IllegalStateException

Implements javax.servlet.http.HttpSession.getSessionContext.

Deprecated

Returns:HttpSessionContext

Doc from javax.servlet.http.HttpSession.getSessionContext.

the HttpSessionContext for this session.

getValueback to summary
public Object getValue(String name) throws IllegalStateException

Implements javax.servlet.http.HttpSession.getValue.

Deprecated

As of Version 2.2, this method is replaced by getAttribute

Parameters
name:String

Doc from javax.servlet.http.HttpSession.getValue.

a string specifying the name of the object

Returns:Object

Doc from javax.servlet.http.HttpSession.getValue.

the object with the specified name

Exceptions
IllegalStateException:

Doc from javax.servlet.http.HttpSession.getValue.

if this method is called on an invalidated session

getValueNamesback to summary
public String[] getValueNames() throws IllegalStateException

Implements javax.servlet.http.HttpSession.getValueNames.

Deprecated

As of Version 2.2, this method is replaced by getAttributeNames

Returns:String[]

Doc from javax.servlet.http.HttpSession.getValueNames.

an array of String objects specifying the names of all the objects bound to this session

Exceptions
IllegalStateException:

Doc from javax.servlet.http.HttpSession.getValueNames.

if this method is called on an invalidated session

initValuesback to summary
protected void initValues()
invalidateback to summary
public void invalidate() throws IllegalStateException

Implements javax.servlet.http.HttpSession.invalidate.

Doc from javax.servlet.http.HttpSession.invalidate.

Invalidates this session then unbinds any objects bound to it.

Exceptions
IllegalStateException:
if this method is called on an already invalidated session
isIdChangedback to summary
public boolean isIdChanged()
isNewback to summary
public boolean isNew() throws IllegalStateException

Implements javax.servlet.http.HttpSession.isNew.

Doc from javax.servlet.http.HttpSession.isNew.

Returns true if the client does not yet know about the session or if the client chooses not to join the session. For example, if the server used only cookie-based sessions, and the client had disabled the use of cookies, then a session would be new on each request.

Returns:boolean

true if the server has created a session, but the client has not yet joined

Exceptions
IllegalStateException:
if this method is called on an already invalidated session
isValidback to summary
protected boolean isValid()
newAttributeMapback to summary
protected abstract Map<K, V> newAttributeMap()
putValueback to summary
public void putValue(String name, Object value) throws IllegalStateException

Implements javax.servlet.http.HttpSession.putValue.

Deprecated

As of Version 2.2, this method is replaced by setAttribute

Parameters
name:String

Doc from javax.servlet.http.HttpSession.putValue.

the name to which the object is bound; cannot be null

value:Object

Doc from javax.servlet.http.HttpSession.putValue.

the object to be bound; cannot be null

Exceptions
IllegalStateException:

Doc from javax.servlet.http.HttpSession.putValue.

if this method is called on an invalidated session

removeAttributeback to summary
public void removeAttribute(String name)

Implements javax.servlet.http.HttpSession.removeAttribute.

Doc from javax.servlet.http.HttpSession.removeAttribute.

Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

After this method executes, and if the object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueUnbound. The container then notifies any HttpSessionAttributeListeners in the web application.

Parameters
name:String

the name of the object to remove from this session

removeValueback to summary
public void removeValue(String name) throws IllegalStateException

Implements javax.servlet.http.HttpSession.removeValue.

Deprecated

As of Version 2.2, this method is replaced by removeAttribute

Parameters
name:String

Doc from javax.servlet.http.HttpSession.removeValue.

the name of the object to remove from this session

Exceptions
IllegalStateException:

Doc from javax.servlet.http.HttpSession.removeValue.

if this method is called on an invalidated session

setAttributeback to summary
public void setAttribute(String name, Object value)

Implements javax.servlet.http.HttpSession.setAttribute.

Doc from javax.servlet.http.HttpSession.setAttribute.

Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.

After this method executes, and if the new object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueBound. The container then notifies any HttpSessionAttributeListeners in the web application.

If an object was already bound to this session of this name that implements HttpSessionBindingListener, its HttpSessionBindingListener.valueUnbound method is called.

If the value passed in is null, this has the same effect as calling removeAttribute().

Parameters
name:String

the name to which the object is bound; cannot be null

value:Object

the object to be bound

setIdChangedback to summary
public void setIdChanged(boolean changed)
setMaxInactiveIntervalback to summary
public void setMaxInactiveInterval(int secs)

Implements javax.servlet.http.HttpSession.setMaxInactiveInterval.

Doc from javax.servlet.http.HttpSession.setMaxInactiveInterval.

Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.

An interval value of zero or less indicates that the session should never timeout.

Parameters
secs:int

An integer specifying the number of seconds

timeoutback to summary
protected void timeout() throws IllegalStateException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

unbindValueback to summary
protected void unbindValue(String name, Object value)

If value implements HttpSessionBindingListener, call valueUnbound()

willPassivateback to summary
protected void willPassivate()
org.mortbay.jetty.servlet back to summary

public Interface AbstractSessionManager.SessionIf

extends HttpSession
Known Direct Implementers
org.mortbay.jetty.servlet.AbstractSessionManager.Session

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

Method Summary

Modifier and TypeMethod and Description
public AbstractSessionManager.Session
Inherited from javax.servlet.http.HttpSession:
getAttributegetAttributeNamesgetCreationTimegetIdgetLastAccessedTimegetMaxInactiveIntervalgetServletContextgetSessionContextgetValuegetValueNamesinvalidateisNewputValueremoveAttributeremoveValuesetAttributesetMaxInactiveInterval

Method Detail

getSessionback to summary
public AbstractSessionManager.Session getSession()