uCosminexus Application Server, Web Container Functionality Guide

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

2.10.5 Examples of the DD definitions

This subsection describes the examples of the DD definitions that use the HTTP response compression functionality as the examples for each of the following cases:

Organization of this subsection
(1) When the compression condition is specified for the body size of the HTTP response
(2) When the compression condition is specified for the URL pattern
(3) When the compression condition is specified for the Media-Type of the HTTP response
(4) When the compression conditions are combined and specified

(1) When the compression condition is specified for the body size of the HTTP response

The following is an example of definition when the compression condition is specified for the body size of the HTTP response:

<web-app>
 ...
<!-- The filter for Response Compression Filter -->
<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>
 ...
</web-app>

In the definition example, the HTTP response for accessing the URL pattern /* and the body size exceeding 1,000 bytes is compressed.

(2) When the compression condition is specified for the URL pattern

The following is an example of definition when the compression condition is specified for the URL pattern:

<web-app>
 ...
<!-- The filter for Response Compression Filter -->
<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>
 /app/dir/*=rule1;
 *.html=rule1;
 </param-value>
 </init-param>
 <init-param>
 <param-name>rule1</param-name>
 <param-value>
 *: 100;
 </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>/app/*</url-pattern>
</filter-mapping>
 ...
</web-app>

In this definition example, the HTTP response for accessing the URL pattern /app/* and fulfilling the following conditions is compressed:

(3) When the compression condition is specified for the Media-Type of the HTTP response

The following is an example of definition when the compression condition is specified for the Media-Type of HTTP response:

<web-app>
 ...
<!-- The filter for Response Compression Filter -->
<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>
 text/html: 500;
 application/pdf: 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>
 ...
</web-app>

In this definition example, the HTTP response for accessing the URL pattern /* and fulfilling the following conditions is compressed:

(4) When the compression conditions are combined and specified

You can also combine and define the compression conditions as shown in the following example:

<web-app>
 ...
<!-- The filter for Response Compression Filter -->
<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>
 /app/dir1/*=rule1;
 /app/dir2/*=rule2;
 *.html=rule3;
 </param-value>
 </init-param>
 <init-param>
 <param-name>rule1</param-name>
 <param-value>
 *: 500;
 application/pdf: 1000;
 </param-value>
 </init-param>
 <init-param>
 <param-name>rule2</param-name>
 <param-value>
 application/pdf: 2000;
 </param-value>
 </init-param>
 <init-param>
 <param-name>rule3</param-name>
 <param-value>
 *: 100;
 </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>/app/*</url-pattern>
</filter-mapping>
 ...
</web-app>

In this definition example, the HTTP response for accessing the URL pattern /app/* and fulfilling the following conditions is compressed: