10.2.5 Examples of the DD definitions
This section describes the examples of the DD definitions that use the HTTP response compression functionality as the examples for each of the following cases:
-
When the compression condition is specified for the body size of the HTTP response
-
When the compression condition is specified for the URL pattern
-
When the compression condition is specified for the Media-Type of the HTTP response
-
When the compression conditions are combined and specified
- 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:
-
HTTP response for which the HTTP request URL pattern is /app/dir/* and the body size exceeds 100 bytes
-
HTTP response for which the HTTP request URL pattern is *.html and the body size exceeds 100 bytes
(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:
-
HTTP response for which Media-Type is text or html and the body size exceeds 500 bytes
-
HTTP response for which Media-Type is application or pdf and the body size exceeds 1,000 bytes
(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:
-
HTTP response for which the HTTP request URL pattern is /app/dir1/*, Media-Type is other than application or pdf, and the body size exceeds 500 bytes
-
HTTP response for which the HTTP request URL pattern is /app/dir1/*, Media-Type is application or pdf, and the body size exceeds 1,000 bytes
-
HTTP response for which the HTTP request URL pattern is /app/dir2/*, Media-Type is application or pdf, and the body size exceeds 2,000 bytes
-
HTTP response for which the HTTP request URL pattern is *.html and the body size exceeds 100 bytes