Package org.eclipse.jetty.server.session
Class DefaultSessionIdManager
- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.util.component.ContainerLifeCycle
-
- org.eclipse.jetty.server.session.DefaultSessionIdManager
-
- All Implemented Interfaces:
SessionIdManager
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
@ManagedObject @Deprecated(since="2021-05-27") public class DefaultSessionIdManager extends ContainerLifeCycle implements SessionIdManager
Deprecated.The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.DefaultSessionIdManager Manages session ids to ensure each session id within a context is unique, and that session ids can be shared across contexts (but not session contents). There is only 1 session id manager per Server instance. Runs a HouseKeeper thread to periodically check for expired Sessions.- See Also:
HouseKeeper
-
-
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.Container
Container.InheritedListener, Container.Listener
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
__NEW_SESSION_ID
Deprecated.
-
Constructor Summary
Constructors Constructor Description DefaultSessionIdManager(Server server)
Deprecated.DefaultSessionIdManager(Server server, java.util.Random random)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
expireAll(java.lang.String id)
Deprecated.Remove an id from use by telling all contexts to remove a session with this id.java.lang.String
getExtendedId(java.lang.String clusterId, HttpServletRequest request)
Deprecated.Get the session ID with any worker ID.java.lang.String
getId(java.lang.String extendedId)
Deprecated.Get the session ID without any worker ID.java.util.Random
getRandom()
Deprecated.long
getReseed()
Deprecated.Server
getServer()
Deprecated.java.util.Set<SessionHandler>
getSessionHandlers()
Deprecated.Get SessionHandler for every context.HouseKeeper
getSessionHouseKeeper()
Deprecated.java.lang.String
getWorkerName()
Deprecated.Get the workname.void
initRandom()
Deprecated.Set up a random number generator for the sessionids.void
invalidateAll(java.lang.String id)
Deprecated.Invalidate all sessions on all contexts that share the same id.boolean
isIdInUse(java.lang.String id)
Deprecated.java.lang.String
newSessionId(long seedTerm)
Deprecated.java.lang.String
newSessionId(HttpServletRequest request, long created)
Deprecated.Create a new session id if necessary.java.lang.String
renewSessionId(java.lang.String oldClusterId, java.lang.String oldNodeId, HttpServletRequest request)
Deprecated.Generate a new id for a session and update across all SessionManagers.void
setRandom(java.util.Random random)
Deprecated.void
setReseed(long reseed)
Deprecated.Set the reseed probability.void
setServer(Server server)
Deprecated.void
setSessionHouseKeeper(HouseKeeper houseKeeper)
Deprecated.void
setWorkerName(java.lang.String workerName)
Deprecated.Set the workername.java.lang.String
toString()
Deprecated.-
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, unmanage, updateBean, updateBean, updateBeans
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
-
-
-
-
Field Detail
-
__NEW_SESSION_ID
public static final java.lang.String __NEW_SESSION_ID
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultSessionIdManager
public DefaultSessionIdManager(Server server)
Deprecated.- Parameters:
server
- the server associated with the id manager
-
DefaultSessionIdManager
public DefaultSessionIdManager(Server server, java.util.Random random)
Deprecated.- Parameters:
server
- the server associated with the id managerrandom
- a random number generator to use for ids
-
-
Method Detail
-
setServer
public void setServer(Server server)
Deprecated.- Parameters:
server
- the server associated with this id manager
-
getServer
public Server getServer()
Deprecated.- Returns:
- the server associated with this id manager
-
setSessionHouseKeeper
public void setSessionHouseKeeper(HouseKeeper houseKeeper)
Deprecated.- Specified by:
setSessionHouseKeeper
in interfaceSessionIdManager
- Parameters:
houseKeeper
- the housekeeper
-
getSessionHouseKeeper
public HouseKeeper getSessionHouseKeeper()
Deprecated.- Specified by:
getSessionHouseKeeper
in interfaceSessionIdManager
- Returns:
- the housekeeper
-
getWorkerName
@ManagedAttribute(value="unique name for this node", readonly=true) public java.lang.String getWorkerName()
Deprecated.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 interfaceSessionIdManager
- Returns:
- name or null
-
setWorkerName
public void setWorkerName(java.lang.String workerName)
Deprecated.Set the workername. If set, the workername is dot appended to the session ID and can be used to assist session affinity in a load balancer. A worker name starting with $ is used as a request attribute name to lookup the worker name that can be dynamically set by a request Customizer.- Parameters:
workerName
- the name of the worker, if null it is coerced to empty string
-
getRandom
public java.util.Random getRandom()
Deprecated.- Returns:
- the random number generator
-
setRandom
public void setRandom(java.util.Random random)
Deprecated.- Parameters:
random
- a random number generator for generating ids
-
getReseed
public long getReseed()
Deprecated.- Returns:
- the reseed probability
-
setReseed
public void setReseed(long reseed)
Deprecated.Set the reseed probability.- Parameters:
reseed
- If non zero then when a random long modulo the reseed value == 1, theSecureRandom
will be reseeded.
-
newSessionId
public java.lang.String newSessionId(HttpServletRequest request, long created)
Deprecated.Create a new session id if necessary.- Specified by:
newSessionId
in interfaceSessionIdManager
- Parameters:
request
- the request with the sesioncreated
- the timestamp for when the session was created- Returns:
- the new session id
- See Also:
SessionIdManager.newSessionId(javax.servlet.http.HttpServletRequest, long)
-
newSessionId
public java.lang.String newSessionId(long seedTerm)
Deprecated.- Parameters:
seedTerm
- the seed for RNG- Returns:
- a new unique session id
-
isIdInUse
public boolean isIdInUse(java.lang.String id)
Deprecated.- Specified by:
isIdInUse
in interfaceSessionIdManager
- Parameters:
id
- The plain session ID (ie no workername extension)- Returns:
- True if the session ID is in use by at least one context.
- See Also:
SessionIdManager.isIdInUse(java.lang.String)
-
initRandom
public void initRandom()
Deprecated.Set up a random number generator for the sessionids. By preference, use a SecureRandom but allow to be injected.
-
getExtendedId
public java.lang.String getExtendedId(java.lang.String clusterId, HttpServletRequest request)
Deprecated.Get the session ID with any worker ID.- Specified by:
getExtendedId
in interfaceSessionIdManager
- Parameters:
clusterId
- the cluster idrequest
- the request- Returns:
- sessionId plus any worker ID.
-
getId
public java.lang.String getId(java.lang.String extendedId)
Deprecated.Get the session ID without any worker ID.- Specified by:
getId
in interfaceSessionIdManager
- Parameters:
extendedId
- the session id with the worker extension- Returns:
- sessionId without any worker ID.
-
expireAll
public void expireAll(java.lang.String id)
Deprecated.Remove an id from use by telling all contexts to remove a session with this id.- Specified by:
expireAll
in interfaceSessionIdManager
- Parameters:
id
- The session ID without any cluster node extension- See Also:
SessionIdManager.expireAll(java.lang.String)
-
invalidateAll
public void invalidateAll(java.lang.String id)
Deprecated.Description copied from interface:SessionIdManager
Invalidate all sessions on all contexts that share the same id.- Specified by:
invalidateAll
in interfaceSessionIdManager
- Parameters:
id
- the session id
-
renewSessionId
public java.lang.String renewSessionId(java.lang.String oldClusterId, java.lang.String oldNodeId, HttpServletRequest request)
Deprecated.Generate a new id for a session and update across all SessionManagers.- Specified by:
renewSessionId
in interfaceSessionIdManager
- Parameters:
oldClusterId
- the old plain session idoldNodeId
- the old fully qualified idrequest
- the request containing the session- Returns:
- the new session id
- See Also:
SessionIdManager.renewSessionId(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
-
getSessionHandlers
public java.util.Set<SessionHandler> getSessionHandlers()
Deprecated.Get SessionHandler for every context.- Specified by:
getSessionHandlers
in interfaceSessionIdManager
- Returns:
- all SessionHandlers that are running
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classAbstractLifeCycle
- See Also:
Object.toString()
-
-