uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.10.4 Definition in the DD

This subsection describes the DD definitions required for using the HTTP response compression functionality.

To enable the HTTP response compression functionality, you must add the filter definition and filter mapping definition in the DD of the Web applications. The HTTP response compression functionality is enabled only when requests exist for the resources with the URL pattern mapped by the filter mapping definition.

Define the HTTP response compression functionality in web.xml.

The following table lists the definition of HTTP response compression functionality in the DD:

Table 2-40 Definition of HTTP response compression functionality in the DD

Settings Specified tags Setting contents
Filter definition <filter-name> tag in the <filter> tag Specify the name of the filter you want to add. The set value is a fixed value.

Set value (fixed value)
com.hitachi.software.was.web.ResponseCompressionFilter
<filter-class> tag in the <filter> tag Specify the class name of the filter you want to add. The set value is a fixed value.

Set value (fixed value)
com.hitachi.software.was.web.ResponseCompressionFilter
Mapping of the URL pattern and HTTP response compression rules <param-name> tag and <param-value> tag in the <filter-class><init-param> tag Specify the mapping of the URL pattern and the HTTP response compression functionality.
For details, see 2.10.4(1) Mapping of the URL pattern and HTTP response compression rules (url-mapping).
HTTP response compression rules Specify the compression rule name, Media-Type, and compression threshold as the compression rules for HTTP response.
For details, see 2.10.4(2) HTTP response compression rules.
Filter mapping definition <filter-name> tag in the <filter-mapping> tag Specify the filter name. The set value is a fixed value.

Set value (fixed value)
com.hitachi.software.was.web.ResponseCompressionFilter
<url-pattern> tag in the <filter-mapping> tag Specify the mapping of the URL pattern or servlet class and the HTTP response compression filter. The HTTP response compression functionality is enabled only when requests exist for the resources with the URL pattern mapped by the filter mapping definition.
The set value is optional.

The definition contents of the DD are described in the following examples of the DD definitions:

 ...
<filter>
 <filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
 <filter-class>com.hitachi.software.was.web.ResponseCompressionFilter</filter-class>
 <init-param>
 <param-name>url-mapping</param-name>
 <param-value>
 /*=rule1;
 </param-value>
 </init-param>
 <init-param>
 <param-name>rule1</param-name>
 <param-value>
 *: 1000;
 </param-value>
 </init-param>
</filter>
 ...
<!-- The filter mappings for Response Compression Filter -->
<filter-mapping>
 <filter-name>com.hitachi.software.was.web.ResponseCompressionFilter</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>

The part enclosed in the <filter> tag is the filter definition and the part enclosed in the <filter-mapping> tag is the filter mapping definition. The value specified in the <filter-name> tag and <filter-class> tag of the filter definition is fixed in the following package name:

com.hitachi.software.was.web.ResponseCompressionFilter

The contents defined in the <init-param> tag of the DD are as follows:

Organization of this subsection
(1) Mapping of the URL pattern and HTTP response compression rules (url-mapping)
(2) HTTP response compression rules
(3) Notes

(1) Mapping of the URL pattern and HTTP response compression rules (url-mapping)

The <init-param> tag of the DD specifies the mapping of the URL pattern that enables the HTTP response compression functionality and the name of the HTTP response compression rule applied to the specified URL pattern.

The rules for specifying parameters and the mapping rules for URL pattern are as follows:

(a) Rules for specifying parameters
(b) Mapping rules for URL pattern

The path match, extension match, and exact match mapping rules are applicable to the URL pattern defined in the url-mapping parameter. The following shows the mapping rules:

(2) HTTP response compression rules

The <init-param> tag of the DD specifies the Media-Type of the HTTP response to be compressed and the compression threshold.

Media-Type
If the Media-Type specified as the condition is included in the HTTP response, the HTTP response will be compressed with the HTTP response compression functionality.

Compression threshold
The compression threshold is specified as an integer value from 100 to 2,147,483,647. By default, compression threshold 100 is applied to the all Media-Type.
The compression threshold is used for determining whether to compress the HTTP response depending on the size of the HTTP response body. When the size of the HTTP response body exceeds the size defined in the compression threshold, the HTTP response will be compressed with the HTTP response compression functionality.
When the size of the HTTP response is small, by defining the compression threshold you ensure that the time required for HTTP response compression is not longer than the time required for communication.
An appropriate size is decided for the compression threshold depending on the type of resources you want to compress and the speed of communications line; therefore, it is recommended that the size defined in the compression threshold be acquired using actual measurements and be defined appropriately.

The following shows the rules for specifying parameters:

(3) Notes

Take the following precautions when you set up the HTTP response compression filter: