org.mortbay.jetty.servlet

Class AbstractSessionManager

public abstract class AbstractSessionManager extends Object implements SessionManager

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.

Version: $Id: AbstractSessionManager.java,v 1.53 2006/11/22 20:01:10 gregwilkins Exp $

Author: Greg Wilkins (gregw)

Nested Class Summary
abstract classAbstractSessionManager.Session
Field Summary
protected boolean_crossContextSessionIDs
protected ServletHandler_handler
protected boolean_httpOnly
protected boolean_invalidateGlobal
protected int_maxSessions
protected int_minSessions
protected Random_random
protected boolean_secureCookies
protected ArrayList_sessionAttributeListeners
protected ArrayList_sessionListeners
protected Map_sessions
protected boolean_weakRandom
protected static MultiMap__allSessions
static int__distantFuture
Constructor Summary
AbstractSessionManager()
AbstractSessionManager(Random random)
Method Summary
voidaddEventListener(EventListener listener)
booleangetCrossContextSessionIDs()
booleangetHttpOnly()
HttpSessiongetHttpSession(String id)
intgetMaxInactiveInterval()
intgetMaxSessions()
intgetMinSessions()
RandomgetRandom()
intgetScavengePeriod()
booleangetSecureCookies()
CookiegetSessionCookie(HttpSession session, boolean requestIsSecure)
MapgetSessionMap()
intgetSessions()
booleangetUseRequestedId()
StringgetWorkerName()
Get the workname.
voidinitialize(ServletHandler handler)
booleanisInvalidateGlobal()
booleanisStarted()
HttpSessionnewHttpSession(HttpServletRequest request)
protected abstract AbstractSessionManager.SessionnewSession(HttpServletRequest request)
voidremoveEventListener(EventListener listener)
voidresetStats()
voidsetCrossContextSessionIDs(boolean useRequestedId)
Set Cross Context sessions IDs This option activates a mode where a requested session ID can be used to create a new session.
voidsetHttpOnly(boolean httpOnly)
voidsetInvalidateGlobal(boolean global)
voidsetMaxInactiveInterval(int seconds)
voidsetRandom(Random random)
voidsetScavengePeriod(int seconds)
voidsetSecureCookies(boolean secureCookies)
voidsetUseRequestedId(boolean useRequestedId)
Set Use Requested ID.
voidsetWorkerName(String workerName)
Set the workname.
voidstart()
voidstop()

Field Detail

_crossContextSessionIDs

protected boolean _crossContextSessionIDs

_handler

protected transient ServletHandler _handler

_httpOnly

protected boolean _httpOnly

_invalidateGlobal

protected boolean _invalidateGlobal

_maxSessions

protected int _maxSessions

_minSessions

protected int _minSessions

_random

protected transient Random _random

_secureCookies

protected boolean _secureCookies

_sessionAttributeListeners

protected transient ArrayList _sessionAttributeListeners

_sessionListeners

protected transient ArrayList _sessionListeners

_sessions

protected transient Map _sessions

_weakRandom

protected transient boolean _weakRandom

__allSessions

protected static MultiMap __allSessions

__distantFuture

public static final int __distantFuture

Constructor Detail

AbstractSessionManager

public AbstractSessionManager()

AbstractSessionManager

public AbstractSessionManager(Random random)

Method Detail

addEventListener

public void addEventListener(EventListener listener)

getCrossContextSessionIDs

public boolean getCrossContextSessionIDs()

Returns: True if cross context session IDs are first considered for new session IDs

getHttpOnly

public boolean getHttpOnly()

Returns: Returns the httpOnly.

getHttpSession

public HttpSession getHttpSession(String id)

getMaxInactiveInterval

public int getMaxInactiveInterval()

Returns: seconds

getMaxSessions

public int getMaxSessions()

getMinSessions

public int getMinSessions()

getRandom

public Random getRandom()

getScavengePeriod

public int getScavengePeriod()

Returns: seconds

getSecureCookies

public boolean getSecureCookies()

Returns: Returns the secureCookies.

getSessionCookie

public Cookie getSessionCookie(HttpSession session, boolean requestIsSecure)

getSessionMap

public Map getSessionMap()

getSessions

public int getSessions()

getUseRequestedId

public boolean getUseRequestedId()

Deprecated: use getCrossContextSessionIDs session IDs

Returns: True if requested session ID are first considered for new

getWorkerName

public String getWorkerName()
Get the workname. If set, the workername is dot appended to the session ID and can be used to assist session affinity in a load balancer.

Returns: String or null

initialize

public void initialize(ServletHandler handler)

isInvalidateGlobal

public boolean isInvalidateGlobal()

isStarted

public boolean isStarted()

newHttpSession

public HttpSession newHttpSession(HttpServletRequest request)

newSession

protected abstract AbstractSessionManager.Session newSession(HttpServletRequest request)

removeEventListener

public void removeEventListener(EventListener listener)

resetStats

public void resetStats()

setCrossContextSessionIDs

public void setCrossContextSessionIDs(boolean useRequestedId)
Set Cross Context sessions IDs This option activates a mode where a requested session ID can be used to create a new session. This facilitates the sharing of session cookies when cross context dispatches use sessions.

Parameters: useRequestedId True if cross context session ID are first considered for new session IDs

setHttpOnly

public void setHttpOnly(boolean httpOnly)

Parameters: httpOnly The httpOnly to set.

setInvalidateGlobal

public void setInvalidateGlobal(boolean global)

Parameters: global True if session invalidation should be global. ie Sessions in other contexts with the same ID (linked by cross context dispatch or shared session cookie) are invalidated as a group.

setMaxInactiveInterval

public void setMaxInactiveInterval(int seconds)

Parameters: seconds

setRandom

public void setRandom(Random random)

setScavengePeriod

public void setScavengePeriod(int seconds)

Parameters: seconds

setSecureCookies

public void setSecureCookies(boolean secureCookies)

Parameters: secureCookies The secureCookies to set.

setUseRequestedId

public void setUseRequestedId(boolean useRequestedId)

Deprecated: use setCrossContextSessionIDs session IDs

Set Use Requested ID.

Parameters: useRequestedId True if requested session ID are first considered for new

setWorkerName

public void setWorkerName(String workerName)
Set the workname. If set, the workername is dot appended to the session ID and can be used to assist session affinity in a load balancer.

Parameters: workerName

start

public void start()

stop

public void stop()
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.