Package org.apache.catalina.util
Class SessionIdGeneratorBase
- java.lang.Object
- 
- org.apache.catalina.util.LifecycleBase
- 
- org.apache.catalina.util.SessionIdGeneratorBase
 
 
- 
- All Implemented Interfaces:
- Lifecycle,- SessionIdGenerator
 - Direct Known Subclasses:
- StandardSessionIdGenerator
 
 public abstract class SessionIdGeneratorBase extends LifecycleBase implements SessionIdGenerator 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringDEFAULT_SECURE_RANDOM_ALGORITHM- 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
- 
 - 
Constructor SummaryConstructors Constructor Description SessionIdGeneratorBase()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddestroyInternal()Sub-classes implement this method to perform any instance destruction required.java.lang.StringgenerateSessionId()Generate and return a new session identifier.java.lang.StringgetJvmRoute()Return the node identifier associated with this node which will be included in the generated session ID.protected voidgetRandomBytes(byte[] bytes)java.lang.StringgetSecureRandomAlgorithm()Get the name of the algorithm used to create theSecureRandominstances which generate new session IDs.java.lang.StringgetSecureRandomClass()Get the class name of theSecureRandomimplementation used to generate session IDs.java.lang.StringgetSecureRandomProvider()Get the name of the provider used to create theSecureRandominstances which generate new session IDs.intgetSessionIdLength()Return the number of bytes for a session IDprotected voidinitInternal()Sub-classes implement this method to perform any instance initialisation required.voidsetJvmRoute(java.lang.String jvmRoute)Specify the node identifier associated with this node which will be included in the generated session ID.voidsetSecureRandomAlgorithm(java.lang.String secureRandomAlgorithm)Specify a non-default algorithm to use to create instances ofSecureRandomwhich are used to generate session IDs.voidsetSecureRandomClass(java.lang.String secureRandomClass)Specify a non-defaultSecureRandomimplementation to use.voidsetSecureRandomProvider(java.lang.String secureRandomProvider)Specify a non-default provider to use to create instances ofSecureRandomwhich are used to generate session IDs.voidsetSessionIdLength(int sessionIdLength)Specify the number of bytes for a session IDprotected voidstartInternal()Sub-classes must ensure that the state is changed toLifecycleState.STARTINGduring the execution of this method.protected voidstopInternal()Sub-classes must ensure that the state is changed toLifecycleState.STOPPINGduring the execution of this method.- 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.SessionIdGeneratorgenerateSessionId
 
- 
 
- 
- 
- 
Method Detail- 
getSecureRandomClasspublic java.lang.String getSecureRandomClass() Get the class name of theSecureRandomimplementation used to generate session IDs.- Returns:
- The fully qualified class name. nullindicates that the JRE providedSecureRandomimplementation will be used
 
 - 
setSecureRandomClasspublic void setSecureRandomClass(java.lang.String secureRandomClass) Specify a non-defaultSecureRandomimplementation to use. The implementation must be self-seeding and have a zero-argument constructor. If not specified, an instance ofSecureRandomwill be generated.- Parameters:
- secureRandomClass- The fully-qualified class name
 
 - 
getSecureRandomAlgorithmpublic java.lang.String getSecureRandomAlgorithm() Get the name of the algorithm used to create theSecureRandominstances which generate new session IDs.- Returns:
- The name of the algorithm. nullor the empty string means that platform default will be used
 
 - 
setSecureRandomAlgorithmpublic void setSecureRandomAlgorithm(java.lang.String secureRandomAlgorithm) Specify a non-default algorithm to use to create instances ofSecureRandomwhich are used to generate session IDs. If no algorithm is specified, SHA1PRNG will be used. If SHA1PRNG is not available, the platform default will be used. To use the platform default (which may be SHA1PRNG), specifynullor the empty string. If an invalid algorithm and/or provider is specified theSecureRandominstances will be created using the defaults for thisSessionIdGeneratorimplementation. If that fails, theSecureRandominstances will be created using platform defaults.- Parameters:
- secureRandomAlgorithm- The name of the algorithm
 
 - 
getSecureRandomProviderpublic java.lang.String getSecureRandomProvider() Get the name of the provider used to create theSecureRandominstances which generate new session IDs.- Returns:
- The name of the provider. nullor the empty string means that platform default will be used
 
 - 
setSecureRandomProviderpublic void setSecureRandomProvider(java.lang.String secureRandomProvider) Specify a non-default provider to use to create instances ofSecureRandomwhich are used to generate session IDs. If no provider is specified, the platform default is used. To use the platform default specifynullor the empty string. If an invalid algorithm and/or provider is specified theSecureRandominstances will be created using the defaults for thisSessionIdGeneratorimplementation. If that fails, theSecureRandominstances will be created using platform defaults.- Parameters:
- secureRandomProvider- The name of the provider
 
 - 
getJvmRoutepublic java.lang.String getJvmRoute() Return the node identifier associated with this node which will be included in the generated session ID.- Specified by:
- getJvmRoutein interface- SessionIdGenerator
- Returns:
- the node identifier associated with this node which will be included in the generated session ID.
 
 - 
setJvmRoutepublic void setJvmRoute(java.lang.String jvmRoute) Specify the node identifier associated with this node which will be included in the generated session ID.- Specified by:
- setJvmRoutein interface- SessionIdGenerator
- Parameters:
- jvmRoute- The node identifier
 
 - 
getSessionIdLengthpublic int getSessionIdLength() Return the number of bytes for a session ID- Specified by:
- getSessionIdLengthin interface- SessionIdGenerator
- Returns:
- the number of bytes for a session ID
 
 - 
setSessionIdLengthpublic void setSessionIdLength(int sessionIdLength) Specify the number of bytes for a session ID- Specified by:
- setSessionIdLengthin interface- SessionIdGenerator
- Parameters:
- sessionIdLength- Number of bytes
 
 - 
generateSessionIdpublic java.lang.String generateSessionId() Generate and return a new session identifier.- Specified by:
- generateSessionIdin interface- SessionIdGenerator
- Returns:
- the newly generated session id
 
 - 
getRandomBytesprotected void getRandomBytes(byte[] bytes) 
 - 
initInternalprotected void initInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSub-classes implement this method to perform any instance initialisation required.- Specified by:
- initInternalin class- LifecycleBase
- Throws:
- LifecycleException- If the initialisation fails
 
 - 
startInternalprotected void startInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSub-classes must ensure that the state is changed toLifecycleState.STARTINGduring the execution of this method. Changing state will trigger theLifecycle.START_EVENTevent. If a component fails to start it may either throw aLifecycleExceptionwhich will cause it's parent to fail to start or it can place itself in the error state in which caseLifecycleBase.stop()will be called on the failed component but the parent component will continue to start normally.- Specified by:
- startInternalin class- LifecycleBase
- Throws:
- LifecycleException- Start error occurred
 
 - 
stopInternalprotected void stopInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSub-classes must ensure that the state is changed toLifecycleState.STOPPINGduring the execution of this method. Changing state will trigger theLifecycle.STOP_EVENTevent.- Specified by:
- stopInternalin class- LifecycleBase
- Throws:
- LifecycleException- Stop error occurred
 
 - 
destroyInternalprotected void destroyInternal() throws LifecycleExceptionDescription copied from class:LifecycleBaseSub-classes implement this method to perform any instance destruction required.- Specified by:
- destroyInternalin class- LifecycleBase
- Throws:
- LifecycleException- If the destruction fails
 
 
- 
 
-