Top Description Fields Constructors Methods
org.mortbay.jetty.servlet

public Class HashSessionIdManager

extends AbstractLifeCycle
implements SessionIdManager
Class Inheritance
All Implemented Interfaces
org.mortbay.jetty.SessionIdManager, org.mortbay.component.LifeCycle
Imports
java.security.NoSuchAlgorithmException, .SecureRandom, java.util.Random, javax.servlet.http.HttpServletRequest, .HttpSession, org.mortbay.component.AbstractLifeCycle, org.mortbay.jetty.SessionIdManager, org.mortbay.jetty.servlet.AbstractSessionManager.Session, org.mortbay.log.Log, org.mortbay.util.MultiMap

HashSessionIdManager. An in-memory implementation of the session ID manager.

Field Summary

Modifier and TypeField and Description
private static final String
protected Random
pack-priv MultiMap<String>
private boolean
private String
protected static final String
protected static final String
Inherited from org.mortbay.component.AbstractLifeCycle:
_listeners

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
addSession(HttpSession
The session
session
)

Implements org.mortbay.jetty.SessionIdManager.addSession.

Add a session to the list of known sessions for a given ID.
protected void
protected void
public String

Returns:

sessionId without any worker ID.
getClusterId
(String nodeId)

Implements org.mortbay.jetty.SessionIdManager.getClusterId.

Get the session ID without any worker ID.
public String

Returns:

sessionId plus any worker ID.
getNodeId
(String
The ID of the session
clusterId
,
HttpServletRequest request)

Implements org.mortbay.jetty.SessionIdManager.getNodeId.

Get the session ID with any worker ID.
public Random
public String

Returns:

String or null
getWorkerName
()

Implements org.mortbay.jetty.SessionIdManager.getWorkerName.

Get the workname.
public boolean
idInUse(String
The session ID without any cluster node extension
id
)

Implements org.mortbay.jetty.SessionIdManager.idInUse.

public void
invalidateAll(String
The session ID without any cluster node extension
id
)

Implements org.mortbay.jetty.SessionIdManager.invalidateAll.

Call HttpSession#invalidate() on all known sessions for the given id.
public String
public void
removeSession(HttpSession session)

Implements org.mortbay.jetty.SessionIdManager.removeSession.

Remove session from the list of known sessions for a given ID.
public void
setRandom(Random random)

public void
setWorkerName(String workerName)

Set the workname.

Inherited from org.mortbay.component.AbstractLifeCycle:
addLifeCycleListenerisFailedisRunningisStartedisStartingisStoppedisStoppingremoveLifeCycleListenerstartstop

Field Detail

__NEW_SESSION_IDback to summary
private static final String __NEW_SESSION_ID
_randomback to summary
protected Random _random
_sessionsback to summary
pack-priv MultiMap<String> _sessions
_weakRandomback to summary
private boolean _weakRandom
_workerNameback to summary
private String _workerName
SESSION_ID_RANDOM_ALGORITHMback to summary
protected static final String SESSION_ID_RANDOM_ALGORITHM
SESSION_ID_RANDOM_ALGORITHM_ALTback to summary
protected static final String SESSION_ID_RANDOM_ALGORITHM_ALT

Constructor Detail

HashSessionIdManagerback to summary
public HashSessionIdManager()
HashSessionIdManagerback to summary
public HashSessionIdManager(Random random)

Method Detail

addSessionback to summary
public void addSession(HttpSession session)

Implements org.mortbay.jetty.SessionIdManager.addSession.

Doc from org.mortbay.jetty.SessionIdManager.addSession.

Add a session to the list of known sessions for a given ID.

Parameters
session:HttpSession

The session

doStartback to summary
protected void doStart()

Overrides org.mortbay.component.AbstractLifeCycle.doStart.

doStopback to summary
protected void doStop()

Overrides org.mortbay.component.AbstractLifeCycle.doStop.

getClusterIdback to summary
public String getClusterId(String nodeId)

Implements org.mortbay.jetty.SessionIdManager.getClusterId.

Get the session ID without any worker ID.

Returns:String

sessionId without any worker ID.

getNodeIdback to summary
public String getNodeId(String clusterId, HttpServletRequest request)

Implements org.mortbay.jetty.SessionIdManager.getNodeId.

Get the session ID with any worker ID.

Parameters
clusterId:String

Doc from org.mortbay.jetty.SessionIdManager.getNodeId.

The ID of the session

Returns:String

sessionId plus any worker ID.

getRandomback to summary
public Random getRandom()
getWorkerNameback to summary
public String getWorkerName()

Implements org.mortbay.jetty.SessionIdManager.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

String or null

idInUseback to summary
public boolean idInUse(String id)

Implements org.mortbay.jetty.SessionIdManager.idInUse.

Parameters
id:String

Doc from org.mortbay.jetty.SessionIdManager.idInUse.

The session ID without any cluster node extension

Returns:boolean

Doc from org.mortbay.jetty.SessionIdManager.idInUse.

True if the session ID is in use by at least one context.

invalidateAllback to summary
public void invalidateAll(String id)

Implements org.mortbay.jetty.SessionIdManager.invalidateAll.

Doc from org.mortbay.jetty.SessionIdManager.invalidateAll.

Call HttpSession#invalidate() on all known sessions for the given id.

Parameters
id:String

The session ID without any cluster node extension

newSessionIdback to summary
public String newSessionId(HttpServletRequest request, long created)

Implements org.mortbay.jetty.SessionIdManager.newSessionId.

removeSessionback to summary
public void removeSession(HttpSession session)

Implements org.mortbay.jetty.SessionIdManager.removeSession.

Doc from org.mortbay.jetty.SessionIdManager.removeSession.

Remove session from the list of known sessions for a given ID.

setRandomback to summary
public void setRandom(Random random)
setWorkerNameback to summary
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.