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.Lifecycle

      `Lifecycle.SingleUse`

  - ### Field Summary

    - ### Fields inherited from interface org.apache.catalina.Lifecycle

      `AFTER_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 Summary

    Constructors
    Constructor and Description
    `SessionIdGeneratorBase()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `destroyInternal()`
    `String` | `generateSessionId()` Generate and return a new session identifier.
    `String` | `getJvmRoute()` Return the node identifier associated with this node which will be included in the generated session ID.
    `protected void` | `getRandomBytes(byte[] bytes)`
    `int` | `getSessionIdLength()` Return the number of bytes for a session ID
    `protected void` | `initInternal()`
    `void` | `setJvmRoute(String jvmRoute)` Specify the node identifier associated with this node which will be included in the generated session ID.
    `void` | `setSecureRandomAlgorithm(String secureRandomAlgorithm)` Specify a non-default algorithm to use to generate random numbers.
    `void` | `setSecureRandomClass(String secureRandomClass)` Specify a non-default @{link `SecureRandom` implementation to use.
    `void` | `setSecureRandomProvider(String secureRandomProvider)` Specify a non-default provider to use to generate random numbers.
    `void` | `setSessionIdLength(int sessionIdLength)` Specify the number of bytes for a session ID
    `protected void` | `startInternal()` Sub-classes must ensure that the state is changed to `LifecycleState.STARTING` during the execution of this method.
    `protected void` | `stopInternal()` Sub-classes must ensure that the state is changed to `LifecycleState.STOPPING` during the execution of this method.

    - ### Methods inherited from class org.apache.catalina.util.LifecycleBase

      `addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, 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.apache.catalina.SessionIdGenerator

      `generateSessionId`

- - ### Constructor Detail

    - #### SessionIdGeneratorBase

          public SessionIdGeneratorBase()

  - ### Method Detail

    - #### setSecureRandomClass

          public void setSecureRandomClass(String secureRandomClass)

      Specify a non-default @{link `SecureRandom` implementation to use.
      Parameters:
        `secureRandomClass` - The fully-qualified class name

    - #### setSecureRandomAlgorithm

          public void setSecureRandomAlgorithm(String secureRandomAlgorithm)

      Specify a non-default algorithm to use to generate random numbers.
      Parameters:
        `secureRandomAlgorithm` - The name of the algorithm

    - #### setSecureRandomProvider

          public void setSecureRandomProvider(String secureRandomProvider)

      Specify a non-default provider to use to generate random numbers.
      Parameters:
        `secureRandomProvider` - The name of the provider

    - #### getJvmRoute

          public String getJvmRoute()

      Return the node identifier associated with this node which will be included in the generated session ID.
      Specified by:
        `getJvmRoute` in interface `SessionIdGenerator`

    - #### setJvmRoute

          public void setJvmRoute(String jvmRoute)

      Specify the node identifier associated with this node which will be included in the generated session ID.
      Specified by:
        `setJvmRoute` in interface `SessionIdGenerator`
      Parameters:
        `jvmRoute` - The node identifier

    - #### getSessionIdLength

          public int getSessionIdLength()

      Return the number of bytes for a session ID
      Specified by:
        `getSessionIdLength` in interface `SessionIdGenerator`

    - #### setSessionIdLength

          public void setSessionIdLength(int sessionIdLength)

      Specify the number of bytes for a session ID
      Specified by:
        `setSessionIdLength` in interface `SessionIdGenerator`
      Parameters:
        `sessionIdLength` - Number of bytes

    - #### generateSessionId

          public String generateSessionId()

      Generate and return a new session identifier.
      Specified by:
        `generateSessionId` in interface `SessionIdGenerator`

    - #### getRandomBytes

          protected void getRandomBytes(byte[] bytes)

    - #### initInternal

          protected void initInternal()
                               throws LifecycleException

      Specified by:
        `initInternal` in class `LifecycleBase`
      Throws:
        `LifecycleException`

    - #### startInternal

          protected void startInternal()
                                throws LifecycleException

      Description copied from class: `LifecycleBase`
      Sub-classes must ensure that the state is changed to `LifecycleState.STARTING` during the execution of this method. Changing state will trigger the `Lifecycle.START_EVENT` event. If a component fails to start it may either throw a `LifecycleException` which will cause it's parent to fail to start or it can place itself in the error state in which case `LifecycleBase.stop()` will be called on the failed component but the parent component will continue to start normally.
      Specified by:
        `startInternal` in class `LifecycleBase`
      Throws:
        `LifecycleException`

    - #### stopInternal

          protected void stopInternal()
                               throws LifecycleException

      Description copied from class: `LifecycleBase`
      Sub-classes must ensure that the state is changed to `LifecycleState.STOPPING` during the execution of this method. Changing state will trigger the `Lifecycle.STOP_EVENT` event.
      Specified by:
        `stopInternal` in class `LifecycleBase`
      Throws:
        `LifecycleException`

    - #### destroyInternal

          protected void destroyInternal()
                                  throws LifecycleException

      Specified by:
        `destroyInternal` in class `LifecycleBase`
      Throws:
        `LifecycleException`

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.