Automatic request and response encoding

Two new WAS extensions are available in Version 5, autoRequestEncoding and autoResponseEncoding.

In WAS Version 5, the Web container no longer automatically sets request and response encodings, and response content types. Programmers are expected to set these values using available methods in the Servlet 2.3 Specification. If programmers choose not to use the character encoding methods, they can specify the autoRequestEncoding and autoResponseEncoding extensions, which enable the application server to set the encoding values and content type.

The Web container tries to determine the correct character encoding for the request parameters and data as follows:

  1. It attempts to use the client.encoding.override system property, if one is set.
  2. It looks at the character set (charset) in the Content-Type header.
  3. If the autoRequestEncoding value is set to true, it extracts the "Accept-Language" header value. If found, this value is used in conjuction with the properties/encoding.properties and properties/converter.properties files to derive the character encoding.
  4. It attempts to use the default.client.encoding system property, if one is set.
  5. It uses the ISO-8859-1 character encoding as the default.

The Web container derives the character encoding used for the response as follows:

  1. The servlet code uses the setCharacterEncoding(String encoding) method.
  2. If the autoResponseEncoding value is set to true, it extracts the "Accept-Language" header value. If found, this value is used in conjuction with the properties/encoding.properties and properties/converter.properties files to derive the character encoding.
  3. It uses the ISO-8859-1 character encoding as the default.

Use the Application Assembly Tool (AAT) to change the default values for the autoRequestEncoding and autoResponseEncoding extensions.