# Apache Tomcat 7 Configuration Reference (7.0.108) - The SessionIdGenerator Component

# Apache Tomcat 7

Version 7.0.108, Jan 28 2021

Links

- Docs Home
- Config Ref. Home
- FAQ
- User Comments

Top Level Elements

- Server
- Service

Executors

- Executor

Connectors

- HTTP
- AJP

Containers

- Context
- Engine
- Host
- Cluster

Nested Components

- Global Resources
- JarScanner
- Listeners
- Loader
- Manager
- Realm
- Resources
- SessionIdGenerator
- Valve

Cluster Elements

- Cluster
- Manager
- Channel
- Channel/Membership
- Channel/Sender
- Channel/Receiver
- Channel/Interceptor
- Valve
- Deployer
- ClusterListener

web.xml

- Filter

Other

- System properties

# The SessionIdGenerator Component

Table of Contents

> - Introduction
> - Attributes
>   1. Common Attributes
>   2. Standard Implementation

Introduction

> The SessionIdGenerator element represents the session id generator that will be used to create session ids used by web application HTTP sessions.

> A SessionIdGenerator element MAY be nested inside a Manager component. If it is not included, a default SessionIdGenerator configuration will be created automatically, which is sufficient for most requirements, — see Standard SessionIdGenerator Implementation below for the details of this configuration.

Attributes

> Common Attributes

> > All implementations of SessionIdGenerator support the following attributes:

> > Attribute | Description
> > --- | ---
> > `className` | Java class name of the implementation to use. This class must implement the `org.apache.catalina.SessionIdGenerator` interface. If not specified, the standard value (defined below) will be used.

> > `jvmRoute`

> > A routing identifier for this Tomcat instance. It will be added to the session id to allow for stateless stickyness routing by load balancers. The details on how the `jvmRoute` will be included in the id are implementation dependent. See Standard Implementation for the default behavior.

> > NOTE - The value for this property is inherited automatically from the `jvmRoute` attribute of the Engine element.

> > `sessionIdLength` | The length of session ids created by this SessionIdGenerator. The details on how the `sessionIdLength` influences the session id length are implementation dependent. See Standard Implementation for the default behavior.

> Standard Implementation

> > Tomcat provides a standard implementations of SessionIdGenerator for use.

> > ### Standard SessionIdGenerator Implementation

> > The standard implementation of SessionIdGenerator is org.apache.catalina.util.StandardSessionIdGenerator. It supports the following attributes:

> > Attribute | Description
> > --- | ---
> > `jvmRoute` | A routing identifier for this Tomcat instance. It will be added to the end of the session id separated by a ".".
> > `sessionIdLength` | The length of session ids created by this SessionIdGenerator. More precisely the session id length is twice the value of `sessionIdLength` plus the length of the trailing `jvmRoute` if given. The factor 2 is because the session id is constructed using `sessionIdLength` random bytes, each byte being encoded in two hex characters in the actual id. The default value is 16.

Copyright © 1999-2021, Apache Software Foundation