You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/04/11 23:04:04 UTC

svn commit: r1738643 - in /tomcat/trunk: java/org/apache/coyote/Response.java webapps/docs/changelog.xml

Author: markt
Date: Mon Apr 11 21:04:04 2016
New Revision: 1738643

URL: http://svn.apache.org/viewvc?rev=1738643&view=rev
Log:
Use Locale.toLangaugeTag() to construct the Content-Langauge HTTP header to ensure the locale is correctly represented. Patch provided by zikfat.

Modified:
    tomcat/trunk/java/org/apache/coyote/Response.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/Response.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Response.java?rev=1738643&r1=1738642&r2=1738643&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Response.java Mon Apr 11 21:04:04 2016
@@ -379,17 +379,7 @@ public final class Response {
         this.locale = locale;
 
         // Set the contentLanguage for header output
-        contentLanguage = locale.getLanguage();
-        if ((contentLanguage != null) && (contentLanguage.length() > 0)) {
-            String country = locale.getCountry();
-            StringBuilder value = new StringBuilder(contentLanguage);
-            if ((country != null) && (country.length() > 0)) {
-                value.append('-');
-                value.append(country);
-            }
-            contentLanguage = value.toString();
-        }
-
+        contentLanguage = locale.toLanguageTag();
     }
 
     /**

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1738643&r1=1738642&r2=1738643&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Apr 11 21:04:04 2016
@@ -154,6 +154,11 @@
         <bug>59289</bug>: Do not recycle upgrade processors in unexpected clsoe
         situations. (remm)
       </fix>
+      <fix>
+        <bug>59295</bug>: Use <code>Locale.toLangaugeTag()</code> to construct
+        the <code>Content-Langauge</code> HTTP header to ensure the locale is
+        correctly represented. Patch provided by zikfat. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org