https://bz.apache.org/bugzilla/show_bug.cgi?id=69735

--- Comment #8 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to Remy Maucherat from comment #7)
> (In reply to Michael Osipov from comment #6)
> > (In reply to Remy Maucherat from comment #3)
> > > I would have thought this would be (another) feature in default servlet.
> > > I believe ServletRequest.getLocales() will return a sorted list of locales
> > > according to the quality from the Accept-Language header. So using the 
> > > list
> > > to go through possible lookups would work.
> > 
> > Attention: That method will also return the JVM's locale as well. As far as
> > I remember this was mandated by the Server API spec.
> 
> The javadoc is (the implementation matches it):
>     /**
>      * Returns an <code>Enumeration</code> of <code>Locale</code> objects
> indicating, in decreasing order starting with
>      * the preferred locale, the locales that are acceptable to the client
> based on the Accept-Language header. If the
>      * client request doesn't provide an Accept-Language header, this method
> returns an <code>Enumeration</code>
>      * containing one <code>Locale</code>, the default locale for the server.
>      *
>      * @return an <code>Enumeration</code> of preferred <code>Locale</code>
> objects for the client
>      */
>     Enumeration<Locale> getLocales();
> 
> So the question is if that case where it returns the local JVM's default
> locale needs to be handled. It confused me a little initially so I messed up
> the first patch version.
> Maybe add a check to see if an Accept-Language header is present.

I think it's reasonable to use the JVM's default locale when there is none
presented by the client. The alternative is to perform zero content-negotiation
if an Accept-Language header is not present which would perfectly in-line with
the HTTP specification.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to