org.mortbay.jetty.servlet
Class AbstractSessionManager

java.lang.Object
  |
  +--org.mortbay.jetty.servlet.AbstractSessionManager
All Implemented Interfaces:
LifeCycle, java.io.Serializable, SessionManager
Direct Known Subclasses:
HashSessionManager

public abstract class AbstractSessionManager
extends java.lang.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.31.2.3 2003/10/19 12:14:43 gregwilkins Exp $
Author:
Greg Wilkins (gregw)
See Also:
Serialized Form

Nested Class Summary
 class AbstractSessionManager.Session
           
 
Nested classes inherited from class org.mortbay.jetty.servlet.SessionManager
 
Field Summary
static boolean __24SessionDestroyed
           
static int __distantFuture
           
 
Fields inherited from interface org.mortbay.jetty.servlet.SessionManager
__MaxAge, __SessionCookie, __SessionDomain, __SessionPath, __SessionURL, __SessionUrlPrefix
 
Constructor Summary
AbstractSessionManager()
           
AbstractSessionManager(java.util.Random random)
           
 
Method Summary
 void addEventListener(java.util.EventListener listener)
          Add an event listener.
 HttpSession getHttpSession(java.lang.String id)
           
 int getMaxInactiveInterval()
           
 int getMaxSessions()
           
 int getMinSessions()
           
 int getScavengePeriod()
           
 java.util.Map getSessionMap()
           
 int getSessions()
           
 boolean getUseRequestedId()
           
 java.lang.String getWorkerName()
          Get the workname.
 void initialize(ServletHandler handler)
           
 boolean isStarted()
           
 HttpSession newHttpSession(HttpServletRequest request)
           
 void removeEventListener(java.util.EventListener listener)
           
 void resetStats()
           
 void setMaxInactiveInterval(int seconds)
           
 void setScavengePeriod(int seconds)
           
 void setUseRequestedId(boolean useRequestedId)
           
 void setWorkerName(java.lang.String workerName)
          Set the workname.
 void start()
          Start the LifeCycle.
 void stop()
          Stop the LifeCycle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__distantFuture

public static final int __distantFuture
See Also:
Constant Field Values

__24SessionDestroyed

public static final boolean __24SessionDestroyed
Constructor Detail

AbstractSessionManager

public AbstractSessionManager()

AbstractSessionManager

public AbstractSessionManager(java.util.Random random)
Method Detail

getUseRequestedId

public boolean getUseRequestedId()
Returns:
True if requested session ID are first considered for new session IDs

setUseRequestedId

public void setUseRequestedId(boolean useRequestedId)
Parameters:
useRequestedId - True if requested session ID are first considered for new session IDs

initialize

public void initialize(ServletHandler handler)
Specified by:
initialize in interface SessionManager

getSessionMap

public java.util.Map getSessionMap()

getSessions

public int getSessions()

getMinSessions

public int getMinSessions()

getMaxSessions

public int getMaxSessions()

resetStats

public void resetStats()

getHttpSession

public HttpSession getHttpSession(java.lang.String id)
Specified by:
getHttpSession in interface SessionManager

newHttpSession

public HttpSession newHttpSession(HttpServletRequest request)
Specified by:
newHttpSession in interface SessionManager

getWorkerName

public java.lang.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

setWorkerName

public void setWorkerName(java.lang.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 -

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface SessionManager
Returns:
seconds

setMaxInactiveInterval

public void setMaxInactiveInterval(int seconds)
Specified by:
setMaxInactiveInterval in interface SessionManager
Parameters:
seconds -

getScavengePeriod

public int getScavengePeriod()
Returns:
seconds

setScavengePeriod

public void setScavengePeriod(int seconds)
Parameters:
seconds -

addEventListener

public void addEventListener(java.util.EventListener listener)
                      throws java.lang.IllegalArgumentException
Description copied from interface: SessionManager
Add an event listener.

Specified by:
addEventListener in interface SessionManager
Parameters:
listener - An Event Listener. Individual SessionManagers implemetations may accept arbitrary listener types, but they are expected to at least handle HttpSessionActivationListener, HttpSessionAttributeListener, HttpSessionBindingListener, HttpSessionListener
Throws:
java.lang.IllegalArgumentException - If an unsupported listener is passed.

removeEventListener

public void removeEventListener(java.util.EventListener listener)
Specified by:
removeEventListener in interface SessionManager

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifeCycle
Returns:
True if the LifeCycle has been started.

start

public void start()
           throws java.lang.Exception
Description copied from interface: LifeCycle
Start the LifeCycle.

Specified by:
start in interface LifeCycle
Throws:
java.lang.Exception - An arbitrary exception may be thrown.

stop

public void stop()
Description copied from interface: LifeCycle
Stop the LifeCycle. The LifeCycle may wait for current activities to complete normally, but it can be interrupted.

Specified by:
stop in interface LifeCycle


Copyright ? 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.