Skip to content

Latest commit

 

History

History
246 lines (151 loc) · 5.4 KB

tomcat-ddfc101.md

File metadata and controls

246 lines (151 loc) · 5.4 KB

Tomcat

By default, web applications pushed with SAP Java Buildpack are running in an Apache Tomcat container.

Applications can explicitly define the target application container by using the TARGET_RUNTIME environment variable in the application's manifest.yml file.

Example:


---
applications:
- name: myapp
  ...
  env:
    TARGET_RUNTIME: tomcat

The tomcat application runtime container provides the following standard APIs:

Runtime

Tomcat

Supported Specification Version

tomcat

Apache Tomcat 9

Java Servlets 4.0

Java Server Pages (JSP) 2.3

Expression Language (EL) 3.0

Debugging Support for Other Languages 1.0

Java API for WebSocket 1.1

Java Authentication Service Provider Interface for Containers (JASPIC) 1.1

For more information, see Apache Tomcat: Tomcat Versions

SAP Java Buildpack provides some default configurations for the Apache Tomcat application container. They can be customized by the application with the Resource Configuration 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.maxHttpHeaderSize

The maximum size of the request and response HTTP header, specified in bytes

8192

connector.maxThreads

The maximum number of request processing 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 disables 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:

env:
  JBP_CONFIG_RESOURCE_CONFIGURATION: "['tomcat/conf/server.xml': {'connector.allowTrace':true}]"

SAP Java Buildpack provides the default configurations for unlimited sessions for the Apache Tomcat application container. They can be customized by the application with the Resource Configuration feature. To limit the number of active sessions, set the maxActiveSessions attribute on a Manager element. For example:

Example:

<Context>
  <Manager maxActiveSessions="500" />
</Context>

To set session timeout value of active sessions, set the <session-config> tag in the application's web.xml file:

Example:

<session-config>
    <session-timeout>1</session-timeout>
</session-config>

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}]"
...

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 Tomcat 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 "