10.1.1 Servlet filter provided by Application Server (built-in filter)
In Application Server, a servlet filter (built-in filter) is provided to use the following functionality:
-
Compressing the HTTP responses
To compress the HTTP responses for the HTTP requests, Application Server provides an HTTP response compression filter as the built-in filter.
The following table describes the types of built-in filters. Further, references of the functionality that you can use by embedding the built-in filter in a Web application are also described.
|
Type of built-in filter |
Description of functionality |
Reference manual |
Reference |
|---|---|---|---|
|
HTTP response compression filter |
This functionality compresses the HTTP responses to the HTTP requests for servlets, JSPs, and static contents, in the gzip format. |
This manual |
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.
The action of the built-in filter on HTTP requests and HTTP responses, the restrictions on the operation conditions of the built-in filter are explained below:
- Organization of this subsection
(1) Action on the HTTP requests and HTTP responses
The built-in filter acts on the request header and the request body of the HTTP requests sent from the client, and may delete, add, and change the information. In the same way, the built-in filter may also act on the response header and the response body of the HTTP responses sent from the server. The following table describes the action of the built-in filter on HTTP requests and HTTP responses:
|
Type of built-in filter |
Action on the HTTP request |
Action on the HTTP response |
|---|---|---|
|
HTTP response compression filter |
-- |
When the response body is compressed, gzip is specified in the Content-Encoding header. The response body is compressed in gzip format. |
- Legend:
-
--: Not applicable
(2) Restriction on operation conditions
When you use the user filter and the built-in filter simultaneously, there are restrictions on the order in which the built-in filter is invoked in the filter chain.
The following restrictions are explained for each built-in filter:
-
Restriction on the location
This is the restriction on the location (invocation order) of the built-in filter in the filter chain.
-
Restriction on operation conditions
This is a restriction on the operation conditions, such as the preconditions for operation of the built-in filter.
-
Restriction on the other servlet filters deployed before and after the built-in filter
This is a restriction with respect to servlet filters that are deployed before and after the built-in filter.
(a) Restrictions on an HTTP response compression filter
The following table describes the restrictions on the HTTP response compression filter:
|
Type of restriction |
Description |
|---|---|
|
Restriction on the location |
-- |
|
Restriction on operation conditions |
-- |
|
Restriction on the other servlet filters deployed before and after the built-in filter |
In the case of concurrent use of the HTTP response compression filter and servlet filter that changes the settings of the Content-Length header or the Content-Encoding header by using the setHeader method, addHeader method, setIntHeader method, or addIntHeader method of the javax.servlet.http.HttpServletResponse interface, you need to deploy the servlet filter after the HTTP response compression filter. |
- Legend:
-
--: Not applicable