dev@glassfish.java.net

Re: parameter-encoding in sun-web.xml

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 17 May 2006 13:01:38 -0700

Peter,

Peter Williams wrote On 05/16/06 17:36,:
> In SJSAS 8.1 and 9.0, there are two parameter-encoding blocks allowed in
> sun-web.xml. One globally, and one that can be specified in the
> local-charset-info element. Prior to 8.1, only the one in
> locale-charset-info existed.
>
> IIRC, the global version overrides the one in locale-charset-info. Are
> there any circumstances where this would not be true or that having
> different values in these would do something useful?
>
> It seems to me that it is confusing to the user to offer the ability to
> configure _both_ of these settings.
>
> Is there any reason _not_ to optimize this (the NetBeans Sun
> Configuration UI) such that parameter encodings found in the older
> location (e.g. locale-charset-info) are migrated to the global setting
> and only allow editing of the newer global setting?

The change you're referring to was done in order to address 4867842
("I18n DTD inconsistencies between WebServer 6.1 and 8.0").

WS 6.1 had deprecated <locale-charset-info> (and its
<locale-charset-map> subelement) for these valid reasons:

- <locale-charset-info> maps request locales (obtained by
   a call to ServletRequest.getLocale()) to their encodings,
   using its <locale-charset-map> subelement.
   The container is supposed to pass the mapped-to encoding
   to ServletRequest.setCharacterEncoding().

   This is wrong, because ServletRequest.getLocale() returns the
   value of the "Accept-Language" request header, which must not be
   used to set the request encoding: it is supposed to be used to
   negotiate the *response* locale and encoding!

- Servlet 2.4 added the <locale-encoding-mapping-list> element to the
   deployment descriptor, which maps a (response) locale to its encoding.
   As a result of this, <locale-charset-map> was no longer needed.

Since <parameter-encoding> used to be a subelement of the now deprecated
<locale-charset-info>, but was still useful, it was promoted to become
a direct child of <sun-web-app>.

The <parameter-encoding> subelement of <sun-web-app> takes precedence
over the <parameter-encoding> subelement of the deprecated
<locale-charset-info>.

These changes were propagated to AS 8.0, in order to align with WS.


Jan


>
> -Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>