## 4.1.3.5.1.2.3  Tomcat 9
By default, web applications pushed with SAP Java Buildpack 1 are running in an Apache Tomcat 9 container.
Applications can explicitly define the target application container by using the TARGET\_RUNTIME environment variable in the application's manifest.yml file.
<!-- image -->
## Provided APIs
The tomcat application runtime container provides the following standard APIs:
<!-- image -->
| Runtime   | Full Name                                                          | Supported Specification Version                                                                                                                                                                                                                                                                                            |
|-----------|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| tomcat    | Apache Tomcat 9.0  Note Only relevant for SAP Java Build- pack 1! | Java 8 and later Java Servlets 4.0 Java Server Pages (JSP) 2.3 Expression Language (EL) 3.0 Debugging Support for Other Lan- guages 1.0 Java API for WebSocket 1.1 Java Authentication Service Provider Interface for Containers (JASPIC) 1.1 . . . For a full list of specification versions, see: Apache Tomcat Versions |
## Customize the buildpack defaults
SAP Java Buildpack 1 provides some default configurations for the Apache Tomcat 9 application container. They can be customized by the application with the Resource Configuration [page 318] feature.
Below is a list of all the placeholders than can be customized by the application, along with their default values:
| Placeholder                  | Description                                                                                                                                                                    | Default Value   |
|------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
| connector.maxHttpHeaderSiz e | The maximum size of the request and response HTTP header, specified in bytes                                                                                                   | 8192            |
| connector.maxThreads         | The maximum number of request proc- essing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled | 200             |
| connector.allowTrace         | A Boolean value that enables or disa- bles the TRACE HTTP method                                                                                                               | false           |
To configure the HTTP header size, use:
env:
```
JBP_CONFIG_RESOURCE_CONFIGURATION: "['tomcat/conf/server.xml': {'connector.maxHttpHeaderSize':1024}]"
```
To configure the maximum number of threads, use:
```
env: JBP_CONFIG_RESOURCE_CONFIGURATION: "['tomcat/conf/server.xml': {'connector.maxThreads':800}]"
```
To enable the TRACE HTTP method, use:
```
JBP_CONFIG_RESOURCE_CONFIGURATION: "['tomcat/conf/server.xml':
```
```
env: {'connector.allowTrace':true}]"
```
## Configure the maximum number of active sessions
SAP Java Buildpack 1 provides the default configurations for unlimited sessions for the Apache Tomcat 9 application container. They can be customized by the application with the Resource Configuration [page 318] feature. To limit the number of active sessions, set the maxActiveSessions attribute on a Manager element. For example:
```
 Example <Context> <Manager maxActiveSessions="500" /> </Context>
```
## Configure the session timeout value
To set session timeout value of active sessions, set the &lt;session-config&gt; tag in the application's web.xml file:
```
 Example <session-config> <session-timeout>1</session-timeout> </session-config>
```
## Configure the context path attribute
The default value of context path in server.xml is "" (Empty String). You can override this default value by using app\_context\_root in the application's manifest.yml file. For example:
```
 Example ... env: JBP_CONFIG_TOMCAT: "[tomcat:{app_context_root: test_context_path}]" ...
```
## Configure the cookie processor
In Tomcat 8.5.84, a custom cookie processor has been created, based on the RFC 6265 Cookie Processor. If the PROCESS\_COOKIE environment variable is set to true , then this new cookie processor will override the default one.
Reason : In T omcat Apache 8.5.84, the date format used with the expires attribute of HTTP cookies was corrected to be compliant with RFC 6265. A single space rather than a single dash is now used to separate the day, month, and year components. For more information, see Apache Tomcat: Tomcat 8 Changelog
The purpose of the new cookie processor is to set the Cookie Expire date to format with '-' ( dash ) delimiter instead of ' ' ( space ) so that no errors would be thrown.
Below is a sample error message thrown when not using the new customization:
```
 Example Sample error: "Invalid cookie header: "set-cookie: username=John; Max-Age=21; Expires=Thu, 17 Aug 2023 13:31:55 GMT". Invalid 'expires' attribute: Thu, 17 Aug 2023 13:31:55 GMT "
```