uCosminexus Application Server, Web Container Functionality Guide

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

2.10.2 Conditions for using the HTTP response compression filter

This subsection describes the conditions and precautions for using the HTTP response compression filter.

Organization of this subsection
(1) Preconditions
(2) Required memory size
(3) Conditions for enabling the HTTP response compression functionality
(4) Notes

(1) Preconditions

To use the HTTP response compression functionality, the following preconditions need to be satisfied:

(2) Required memory size

The memory required for the HTTP response compression functionality is obtained with the following formula:

Memory-required-for-the-HTTP-response-compression-functionality (bytes) = Number-of-concurrent-executions-of-the-HTTP-requests-that-enable-the-HTTP-response-compression-functionality [Figure] Response-compression-threshold (bytes)

The compression threshold is used for determining whether to compress the HTTP response depending on the size of the HTTP response body. Only when the size of the HTTP response body exceeds the size defined in the compression threshold, the HTTP response will be compressed. Note that the compression threshold is specified for HTTP requests.

Define the compression threshold in the DD (web.xml). 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.

Decide an appropriate size for the compression threshold depending on the type of resources you want to compress and the speed of communications line. Hitachi recommends that you acquire the size defined in the compression threshold using the actual measurements and define the appropriate size.

(3) Conditions for enabling the HTTP response compression functionality

You can specify conditions for enabling the HTTP response compression functionality. The conditions that can be specified are explained below.

(4) Notes

Precautions related to the definition of the HTTP response compression filter
When using the HTTP response compression filter, after considering the action of the built-in filter on the HTTP requests and HTTP responses and the restrictions on the order of the filter chain, you need to embed HTTP response compression filter in a Web application. For details on the built-in filter, see 2.9.1 Servlet filter provided by Application Server (built-in filter).
Note that with Servlet 3.0 or later, you can define a filter by using an API and not the web.xml file. However, you cannot use an API to define a built-in filter.

Precautions related to error pages
In the Web applications that use the HTTP response compression functionality, you can customize the error pages by using the following functionality:
  • Error page customization with the Web server functionality
  • Error page customization based on in-process HTTP server
  • Error page customization with the <error-page> tag of web.xml
When using the error page with the <error-page> tag of web.xml, specify the servlet that acquires and uses javax.servlet.ServletOutputStream from the static contents or response in the error page.
In the HTTP response compression functionality, you use javax.servlet.ServletOutputStream acquired from the response object to output the compressed data. Therefore, java.io.PrintWriter cannot be acquired from the response object in the servlet or JSP that generates an error page.