glassfish
  1. glassfish
  2. GLASSFISH-20729

ServletRequest.getLocales() and BCP47 style Language tags.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: v2.1.1, v3.0.1, 4.0
    • Fix Version/s: 4.1
    • Component/s: web_container
    • Labels:
      None

      Description

      If a user agent sends an Accept-Language: header with language tags that conform to BCP47 <http://tools.ietf.org/html/bcp47>, the current implementation of ServletRequest.getLocales() may not behave correctly. This is because additional actions must be taken with new methods in the java.util.Locale API added in JavaSE 7.

      For more on this issue see bugdb bug 14676641.

        Activity

        Hide
        Ed Burns added a comment -

        >>>>> On Fri, 26 Jul 2013 12:27:47 -0700, Blake Sullivan said:

        B> The correct thing to do in Java 7 is to create the correct locale by
        B> calling Locale, forLanguageTag() on each locale passed in (which is
        B> one of the reasons for preserving the BCP locales) and fixing your
        B> locale matching code to take the scripts into account (the scripts
        B> are more important than the territories, which is why they appear
        B> after the languages in the BCP locales). The Locale code in Java7
        B> should make the comparisons you want work correctly because I believe
        B> that "zh-TW" will be turned into "zh-Hant-TW. Therefore a request
        B> for "zh-Hant" will match "zh-Hant-TW", which is what you want.

        Show
        Ed Burns added a comment - >>>>> On Fri, 26 Jul 2013 12:27:47 -0700, Blake Sullivan said: B> The correct thing to do in Java 7 is to create the correct locale by B> calling Locale, forLanguageTag() on each locale passed in (which is B> one of the reasons for preserving the BCP locales) and fixing your B> locale matching code to take the scripts into account (the scripts B> are more important than the territories, which is why they appear B> after the languages in the BCP locales). The Locale code in Java7 B> should make the comparisons you want work correctly because I believe B> that "zh-TW" will be turned into "zh-Hant-TW. Therefore a request B> for "zh-Hant" will match "zh-Hant-TW", which is what you want.
        Hide
        Shing Wai Chan added a comment -

        In GlassFish, ServletRequest.getLocale has delegated to Grizzly which is in JDK 6.
        We can override that in GlassFish if necessary. Let me do further investigation.

        Show
        Shing Wai Chan added a comment - In GlassFish, ServletRequest.getLocale has delegated to Grizzly which is in JDK 6. We can override that in GlassFish if necessary. Let me do further investigation.
        Hide
        Ryan Lubke added a comment -

        Fixed in Grizzly 2.3.5 (not yet released) under https://java.net/jira/browse/GRIZZLY-1570 .

        Show
        Ryan Lubke added a comment - Fixed in Grizzly 2.3.5 (not yet released) under https://java.net/jira/browse/GRIZZLY-1570 .
        Hide
        Ed Burns added a comment -

        Because this is fixed in GRIZZLY-1570, can we close this issue?

        Show
        Ed Burns added a comment - Because this is fixed in GRIZZLY-1570 , can we close this issue?
        Hide
        Shing Wai Chan added a comment -

        The trunk is in Grizzly 2.3.3, not even Grizzly 2.3.4. That is why I have not closed the issue yet.

        Show
        Shing Wai Chan added a comment - The trunk is in Grizzly 2.3.3, not even Grizzly 2.3.4. That is why I have not closed the issue yet.
        Hide
        Shing Wai Chan added a comment -

        Grizzly 2.3.11 has been integrated into GlassFish trunk.

        Show
        Shing Wai Chan added a comment - Grizzly 2.3.11 has been integrated into GlassFish trunk.
        Hide
        Shing Wai Chan added a comment -

        The fix is in Grizzly 2.3.5. GlassFish already has Grizzly 2.3.11.

        Show
        Shing Wai Chan added a comment - The fix is in Grizzly 2.3.5. GlassFish already has Grizzly 2.3.11.

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            Ed Burns
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: