incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r885596 - in /incubator/wink/trunk: wink-common/src/main/java/org/apache/wink/common/internal/ResponseImpl.java wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java
Date Mon, 30 Nov 2009 22:23:10 GMT
Author: bluk
Date: Mon Nov 30 22:23:09 2009
New Revision: 885596

URL: http://svn.apache.org/viewvc?rev=885596&view=rev
Log:
Use HeaderUtils when converting Locale to language

See [WINK-235]

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/ResponseImpl.java
    incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/ResponseImpl.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/ResponseImpl.java?rev=885596&r1=885595&r2=885596&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/ResponseImpl.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/ResponseImpl.java
Mon Nov 30 22:23:09 2009
@@ -33,6 +33,8 @@
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Variant;
 
+import org.apache.wink.common.internal.utils.HeaderUtils;
+
 public class ResponseImpl extends Response {
 
     private static final int               DEFAULT_STATUS = -1;
@@ -144,7 +146,8 @@
 
         @Override
         public ResponseBuilder language(Locale language) {
-            return singleHeader(HttpHeaders.CONTENT_LANGUAGE, language);
+            return singleHeader(HttpHeaders.CONTENT_LANGUAGE, language == null ? null : HeaderUtils
+                .localeToLanguage(language));
         }
 
         @Override

Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java?rev=885596&r1=885595&r2=885596&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java
(original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java
Mon Nov 30 22:23:09 2009
@@ -482,7 +482,7 @@
         assertEquals(200, response.getStatus());
         assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("gzip", response.getHeader(HttpHeaders.CONTENT_ENCODING));
-        assertEquals("en_US", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
+        assertEquals("en-US", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
         assertEquals(HttpHeaders.ACCEPT + ", "
             + HttpHeaders.ACCEPT_LANGUAGE
             + ", "
@@ -535,7 +535,7 @@
         assertEquals(200, response.getStatus());
         assertEquals(MediaType.TEXT_PLAIN + ";charset=shift_jis", response.getContentType());
         assertEquals("gzip", response.getHeader(HttpHeaders.CONTENT_ENCODING));
-        assertEquals("en_US", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
+        assertEquals("en-US", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
         assertEquals(HttpHeaders.ACCEPT + ", "
             + HttpHeaders.ACCEPT_LANGUAGE
             + ", "



Mime
View raw message