org.eclipse.jetty.server.session
Class AbstractSessionIdManager

java.lang.Object
  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.server.session.AbstractSessionIdManager
All Implemented Interfaces:
SessionIdManager, LifeCycle
Direct Known Subclasses:
HashSessionIdManager, JDBCSessionIdManager

public abstract class AbstractSessionIdManager
extends AbstractLifeCycle
implements SessionIdManager


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
 
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
 
Field Summary
protected  Random _random
           
protected  boolean _weakRandom
           
protected  String _workerName
           
 
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
Constructor Summary
AbstractSessionIdManager()
           
AbstractSessionIdManager(Random random)
           
 
Method Summary
protected  void doStart()
           
protected  void doStop()
           
 Random getRandom()
           
 String getWorkerName()
          Get the workname.
 void initRandom()
          Set up a random number generator for the sessionids.
 String newSessionId(HttpServletRequest request, long created)
          Create a new session id if necessary.
 void setRandom(Random random)
           
 void setWorkerName(String workerName)
          Set the workname.
 
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jetty.server.SessionIdManager
addSession, getClusterId, getNodeId, idInUse, invalidateAll, removeSession
 
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Field Detail

_random

protected Random _random

_weakRandom

protected boolean _weakRandom

_workerName

protected String _workerName
Constructor Detail

AbstractSessionIdManager

public AbstractSessionIdManager()

AbstractSessionIdManager

public AbstractSessionIdManager(Random random)
Method Detail

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.

Specified by:
getWorkerName in interface SessionIdManager
Returns:
String or null

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 -

getRandom

public Random getRandom()

setRandom

public void setRandom(Random random)

newSessionId

public String newSessionId(HttpServletRequest request,
                           long created)
Create a new session id if necessary.

Specified by:
newSessionId in interface SessionIdManager
Returns:
the new session id
See Also:
SessionIdManager.newSessionId(javax.servlet.http.HttpServletRequest, long)

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class AbstractLifeCycle
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class AbstractLifeCycle
Throws:
Exception

initRandom

public void initRandom()
Set up a random number generator for the sessionids. By preference, use a SecureRandom but allow to be injected.



Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.