wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jra...@apache.org
Subject svn commit: r939792 - in /incubator/wink/trunk: wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/ wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/ wink-itests/wink-itest/w...
Date Fri, 30 Apr 2010 19:37:04 GMT
Author: jramos
Date: Fri Apr 30 19:37:04 2010
New Revision: 939792

URL: http://svn.apache.org/viewvc?rev=939792&view=rev
Log:
[WINK-279] Adjust ServerMediaTypeCharsetAdjuster to set charset on MultiValuedMap parameter rather than on the HttpServletResponse; do not define a default charset by default; update unit and itests affected by changes

Modified:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjuster.java
    incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties
    incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/RequestsTest.java
    incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java
    incubator/wink/trunk/wink-webdav/src/test/java/org/apache/wink/webdav/server/AbstractWebDAVResourcesTest.java

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java Fri Apr 30 19:37:04 2010
@@ -170,7 +170,7 @@ public class JAXRSHttpHeadersTest extend
             assertEquals(200, getMethod.getStatusCode());
             String responseBody = getMethod.getResponseBodyAsString();
             assertEquals("acceptablemediatypes:text/plain:", responseBody);
-            assertEquals("text/plain" + ";charset=UTF-8", getMethod
+            assertEquals("text/plain", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -196,7 +196,7 @@ public class JAXRSHttpHeadersTest extend
             String responseBody = getMethod.getResponseBodyAsString();
             assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:",
                          responseBody);
-            assertEquals("text/plain;q=1.0" + ";charset=UTF-8", getMethod
+            assertEquals("text/plain;q=1.0", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java Fri Apr 30 19:37:04 2010
@@ -162,7 +162,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         String responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:", responseBody);
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -171,7 +171,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:", responseBody);
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -180,7 +180,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:", responseBody);
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders()
             .getFirst("Content-Type"));
     }
 
@@ -214,7 +214,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         String responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("text/plain;q=1.0", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -224,7 +224,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("text/plain;q=1.0", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -234,7 +234,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("text/plain;q=1.0", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -245,7 +245,7 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("text/plain;q=1.0", response.getHeaders()
             .getFirst("Content-Type"));
     }
 

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java Fri Apr 30 19:37:04 2010
@@ -55,7 +55,7 @@ public class PersonAppTest extends TestC
         try {
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", postMethod
+            assertEquals(MediaType.TEXT_PLAIN, postMethod
                 .getResponseHeader(HttpHeaders.CONTENT_TYPE).getValue());
             assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix entity: Hello",
                          postMethod.getResponseBodyAsString());
@@ -70,7 +70,7 @@ public class PersonAppTest extends TestC
         try {
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals(MediaType.TEXT_XML + ";charset=UTF-8", postMethod.getResponseHeader(HttpHeaders.CONTENT_TYPE)
+            assertEquals(MediaType.TEXT_XML, postMethod.getResponseHeader(HttpHeaders.CONTENT_TYPE)
                 .getValue());
             assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix entity: Hello",
                          postMethod.getResponseBodyAsString());

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java Fri Apr 30 19:37:04 2010
@@ -49,7 +49,7 @@ public class WinkPersonAppTest extends T
             client.resource(getBaseURI() + "/person/abcd").contentType(MediaType.TEXT_PLAIN)
                 .post("Hello");
         assertEquals(200, response.getStatusCode());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders()
             .getFirst(HttpHeaders.CONTENT_TYPE));
         assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix entity: Hello",
                      response.getEntity(String.class));
@@ -60,7 +60,7 @@ public class WinkPersonAppTest extends T
             client.resource(getBaseURI() + "/person/abcd").contentType(MediaType.TEXT_XML)
                 .post("Hello");
         assertEquals(200, response.getStatusCode());
-        assertEquals(MediaType.TEXT_XML + ";charset=UTF-8", response.getHeaders()
+        assertEquals(MediaType.TEXT_XML, response.getHeaders()
             .getFirst(HttpHeaders.CONTENT_TYPE));
         assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix entity: Hello",
                      response.getEntity(String.class));

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java Fri Apr 30 19:37:04 2010
@@ -293,7 +293,7 @@ public class JAXRSMessageBodyReadersTest
             client.executeMethod(postMethod);
 
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals("text/plain" + ";charset=UTF-8", postMethod
+            assertEquals("text/plain", postMethod
                 .getResponseHeader("Content-Type").getValue());
             assertEquals("Hello thereWorld there", postMethod.getResponseBodyAsString());
         } finally {
@@ -323,7 +323,7 @@ public class JAXRSMessageBodyReadersTest
             client.executeMethod(postMethod);
 
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals("text/plain" + ";charset=UTF-8", postMethod
+            assertEquals("text/plain", postMethod
                 .getResponseHeader("Content-Type").getValue());
             assertEquals("Hello thereWorld there", postMethod.getResponseBodyAsString());
         } finally {

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java Fri Apr 30 19:37:04 2010
@@ -82,7 +82,7 @@ public class JAXRSReaderTest extends Tes
             String str = new String(carr);
 
             assertEquals("abcd", str);
-            assertEquals("text/plain;charset=UTF-8", postMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
             Header contentLengthHeader = postMethod.getResponseHeader("Content-Length");
             assertNull(contentLengthHeader == null ? "null" : contentLengthHeader.getValue(),
                        contentLengthHeader);
@@ -187,7 +187,7 @@ public class JAXRSReaderTest extends Tes
             String str = new String(carr);
 
             assertEquals("wxyz", str);
-            assertEquals("mytype/subtype;charset=UTF-8", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("mytype/subtype", getMethod.getResponseHeader("Content-Type").getValue());
 
             Header contentLengthHeader = getMethod.getResponseHeader("Content-Length");
             assertNull(contentLengthHeader == null ? "null" : contentLengthHeader.getValue(),

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java Fri Apr 30 19:37:04 2010
@@ -350,7 +350,7 @@ public class JAXRSMessageBodyWritersTest
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello there", getMethod.getResponseBodyAsString());
-            assertEquals("text/plain" + ";charset=UTF-8", getMethod
+            assertEquals("text/plain", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -364,7 +364,7 @@ public class JAXRSMessageBodyWritersTest
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello there", getMethod.getResponseBodyAsString());
-            assertEquals("text/xml" + ";charset=UTF-8", getMethod.getResponseHeader("Content-Type")
+            assertEquals("text/xml", getMethod.getResponseHeader("Content-Type")
                 .getValue());
         } finally {
             getMethod.releaseConnection();

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java Fri Apr 30 19:37:04 2010
@@ -260,7 +260,7 @@ public class NullValuesDuringTargettingT
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
             assertEquals("calledWithProduces", postMethod.getResponseBodyAsString());
-            assertEquals("custom/type;q=0.8" + ";charset=UTF-8", postMethod.getResponseHeader("Content-Type")
+            assertEquals("custom/type;q=0.8", postMethod.getResponseHeader("Content-Type")
                 .getValue());
         } finally {
             postMethod.releaseConnection();
@@ -281,7 +281,7 @@ public class NullValuesDuringTargettingT
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
             assertEquals("calledWithoutProduces", postMethod.getResponseBodyAsString());
-            assertEquals("custom/type2;q=0.8" + ";charset=UTF-8", postMethod.getResponseHeader("Content-Type")
+            assertEquals("custom/type2;q=0.8", postMethod.getResponseHeader("Content-Type")
                 .getValue());
         } finally {
             postMethod.releaseConnection();
@@ -301,7 +301,7 @@ public class NullValuesDuringTargettingT
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
             assertEquals("calledWithProduces", postMethod.getResponseBodyAsString());
-            assertEquals("custom/type" + ";charset=UTF-8", postMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("custom/type", postMethod.getResponseHeader("Content-Type").getValue());
         } finally {
             postMethod.releaseConnection();
         }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java Fri Apr 30 19:37:04 2010
@@ -60,7 +60,7 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/json" + ";charset=UTF-8", getMethod
+            assertEquals("application/json", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -74,7 +74,7 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello XML Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/xml" + ";charset=UTF-8", getMethod
+            assertEquals("application/xml", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -144,7 +144,7 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Consumes And Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/json" + ";charset=UTF-8", getMethod
+            assertEquals("application/json", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -157,7 +157,7 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Consumes And Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/json" + ";charset=UTF-8", getMethod
+            assertEquals("application/json", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -176,12 +176,12 @@ public class ValidationDuringTargettingT
                 assertEquals(200, getMethod.getStatusCode());
                 assertEquals("Hello XML Consumes And JSON Produces", getMethod
                     .getResponseBodyAsString());
-                assertEquals("application/json" + ";charset=UTF-8", getMethod
+                assertEquals("application/json", getMethod
                     .getResponseHeader("Content-Type").getValue());
             } else {
                 assertEquals(200, getMethod.getStatusCode());
                 assertEquals("Hello XML Consumes And Produces", getMethod.getResponseBodyAsString());
-                assertEquals("application/xml" + ";charset=UTF-8", getMethod
+                assertEquals("application/xml", getMethod
                     .getResponseHeader("Content-Type").getValue());
             }
         } finally {
@@ -196,7 +196,7 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello XML Consumes And Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/xml" + ";charset=UTF-8", getMethod
+            assertEquals("application/xml", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
@@ -211,7 +211,7 @@ public class ValidationDuringTargettingT
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello XML Consumes And JSON Produces", getMethod
                 .getResponseBodyAsString());
-            assertEquals("application/json" + ";charset=UTF-8", getMethod
+            assertEquals("application/json", getMethod
                 .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java Fri Apr 30 19:37:04 2010
@@ -229,7 +229,7 @@ public class WinkNullValuesDuringTargeti
                 .accept("custom/type; q=0.8").post(null);
         assertEquals(200, response.getStatusCode());
         assertEquals("calledWithProduces", response.getEntity(String.class));
-        assertEquals(MediaType.valueOf("custom/type;q=0.8" + ";charset=UTF-8"), MediaType
+        assertEquals(MediaType.valueOf("custom/type;q=0.8"), MediaType
             .valueOf(response.getHeaders().getFirst("Content-Type")));
     }
 
@@ -245,7 +245,7 @@ public class WinkNullValuesDuringTargeti
                 .accept("custom/type2; q=0.8").post(null);
         assertEquals(200, response.getStatusCode());
         assertEquals("calledWithoutProduces", response.getEntity(String.class));
-        assertEquals(MediaType.valueOf("custom/type2;q=0.8" + ";charset=UTF-8"), MediaType
+        assertEquals(MediaType.valueOf("custom/type2;q=0.8"), MediaType
             .valueOf(response.getHeaders().getFirst("Content-Type")));
     }
 
@@ -260,7 +260,7 @@ public class WinkNullValuesDuringTargeti
             client.resource(getBaseURI() + "/targeting/nullresource/withproduces").post(null);
         assertEquals(200, response.getStatusCode());
         assertEquals("calledWithProduces", response.getEntity(String.class));
-        assertEquals("custom/type" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("custom/type", response.getHeaders()
             .getFirst("Content-Type"));
     }
 

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java (original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java Fri Apr 30 19:37:04 2010
@@ -57,7 +57,7 @@ public class WinkValidationDuringTargeti
                 .accept(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello JSON Produces", response.getEntity(String.class));
-        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("application/json", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -65,7 +65,7 @@ public class WinkValidationDuringTargeti
                 .accept(MediaType.APPLICATION_XML).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello XML Produces", response.getEntity(String.class));
-        assertEquals("application/xml" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("application/xml", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -110,7 +110,7 @@ public class WinkValidationDuringTargeti
                 .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello JSON Consumes And Produces", response.getEntity(String.class));
-        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("application/json", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -118,7 +118,7 @@ public class WinkValidationDuringTargeti
                 .contentType(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello JSON Consumes And Produces", response.getEntity(String.class));
-        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("application/json", response.getHeaders()
             .getFirst("Content-Type"));
 
         /*
@@ -133,12 +133,12 @@ public class WinkValidationDuringTargeti
             .getFirst("Content-Type")))) {
             assertEquals(200, response.getStatusCode());
             assertEquals("Hello XML Consumes And JSON Produces", response.getEntity(String.class));
-            assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+            assertEquals("application/json", response.getHeaders()
                 .getFirst("Content-Type"));
         } else {
             assertEquals(200, response.getStatusCode());
             assertEquals("Hello XML Consumes And Produces", response.getEntity(String.class));
-            assertEquals("application/xml" + ";charset=UTF-8", response.getHeaders()
+            assertEquals("application/xml", response.getHeaders()
                 .getFirst("Content-Type"));
         }
 
@@ -147,7 +147,7 @@ public class WinkValidationDuringTargeti
                 .contentType(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello XML Consumes And Produces", response.getEntity(String.class));
-        assertEquals("application/xml" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("application/xml", response.getHeaders()
             .getFirst("Content-Type"));
 
         response =
@@ -155,7 +155,7 @@ public class WinkValidationDuringTargeti
                 .contentType(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello XML Consumes And JSON Produces", response.getEntity(String.class));
-        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+        assertEquals("application/json", response.getHeaders()
             .getFirst("Content-Type"));
     }
 }

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjuster.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjuster.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjuster.java (original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjuster.java Fri Apr 30 19:37:04 2010
@@ -19,7 +19,6 @@
  */
 package org.apache.wink.server.internal.contexts;
 
-import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -73,11 +72,7 @@ public class ServerMediaTypeCharsetAdjus
                         }
                         String newMediaTypeStr = mediaType.toString() + ";charset=" + charsetValue;
                         mediaType = MediaType.valueOf(newMediaTypeStr);
-                        if (context != null) {
-                            HttpServletResponse response =
-                                context.getAttribute(HttpServletResponse.class);
-                            response.setContentType(newMediaTypeStr);
-                        }
+                        httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, newMediaTypeStr);
                         logger.debug("Changed media type to be {} in Content-Type HttpHeader", newMediaTypeStr); //$NON-NLS-1$
                     } catch (Exception e) {
                         logger.debug("Caught exception while trying to set the charset", e); //$NON-NLS-1$

Modified: incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties (original)
+++ incubator/wink/trunk/wink-server/src/main/resources/META-INF/wink-default.properties Fri Apr 30 19:37:04 2010
@@ -46,9 +46,9 @@ wink.serviceDocumentCssPath=
 wink.loadApplications=true
 
 # Response Content-Type header should be UTF-8 if none is already specified
-# true: default to UTF-8 (default)
-# false: do not assign a default charset to the Content-Type response header
-wink.response.defaultCharset=true
+# true: default to UTF-8
+# false: do not assign a default charset to the Content-Type response header (default)
+wink.response.defaultCharset=false
 
 # Response Content-Type header should default to the highest q-valued Accept-Charset value if Accept-Charset header exists
 # This option overrides wink.response.defaultCharset when the Accept-Charset header is present

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=939792&r1=939791&r2=939792&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 Fri Apr 30 19:37:04 2010
@@ -293,7 +293,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_LANGUAGE, "en");
         MockHttpServletResponse response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("en", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
         assertEquals(HttpHeaders.ACCEPT_LANGUAGE, response.getHeader(HttpHeaders.VARY));
         assertNull(response.getHeader(HttpHeaders.CONTENT_ENCODING));
@@ -305,7 +305,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_LANGUAGE, "fr");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("fr", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
         assertEquals(HttpHeaders.ACCEPT_LANGUAGE, response.getHeader(HttpHeaders.VARY));
         assertNull(response.getHeader(HttpHeaders.CONTENT_ENCODING));
@@ -319,7 +319,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_LANGUAGE, "en;q=0.6,fr;q=0.5");
         MockHttpServletResponse response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("en", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
         assertEquals(HttpHeaders.ACCEPT_LANGUAGE, response.getHeader(HttpHeaders.VARY));
 
@@ -330,7 +330,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_LANGUAGE, "en;q=0.6,fr;q=0.7");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("fr", response.getHeader(HttpHeaders.CONTENT_LANGUAGE));
         assertEquals(HttpHeaders.ACCEPT_LANGUAGE, response.getHeader(HttpHeaders.VARY));
     }
@@ -344,7 +344,7 @@ public class RequestsTest extends MockSe
                                                         MediaType.TEXT_PLAIN);
         MockHttpServletResponse response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("identity", response.getHeader(HttpHeaders.CONTENT_ENCODING));
         assertEquals(HttpHeaders.ACCEPT_ENCODING, response.getHeader(HttpHeaders.VARY));
 
@@ -355,7 +355,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_ENCODING, "gzip");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("gzip", response.getHeader(HttpHeaders.CONTENT_ENCODING));
         assertEquals(HttpHeaders.ACCEPT_ENCODING, response.getHeader(HttpHeaders.VARY));
 
@@ -374,7 +374,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_ENCODING, "gzip");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("gzip", response.getHeader(HttpHeaders.CONTENT_ENCODING));
         assertEquals(HttpHeaders.ACCEPT_ENCODING, response.getHeader(HttpHeaders.VARY));
     }
@@ -387,7 +387,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_ENCODING, "gzip;q=0.8,deflate;q=0.7");
         MockHttpServletResponse response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("gzip", response.getHeader(HttpHeaders.CONTENT_ENCODING));
         assertEquals(HttpHeaders.ACCEPT_ENCODING, response.getHeader(HttpHeaders.VARY));
 
@@ -398,7 +398,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_ENCODING, "deflate;q=0.8,gzip;q=0.7");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
         assertEquals("deflate", response.getHeader(HttpHeaders.CONTENT_ENCODING));
         assertEquals(HttpHeaders.ACCEPT_ENCODING, response.getHeader(HttpHeaders.VARY));
     }
@@ -433,7 +433,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_CHARSET, "shift_jis, *;q=0.5");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=shift_jis", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN  + ";charset=shift_jis", response.getContentType());
         assertEquals("Accept, Accept-Charset", response.getHeader(HttpHeaders.VARY));
 
         request =
@@ -441,7 +441,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_CHARSET, "SHIFT_jis, *;q=0.5");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=shift_jis", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN  + ";charset=shift_jis", response.getContentType());
         assertEquals("Accept, Accept-Charset", response.getHeader(HttpHeaders.VARY));
 
         request =
@@ -449,7 +449,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_CHARSET, "shift_jis, iso-8859-1;q=0.5");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=shift_jis", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN  + ";charset=shift_jis", response.getContentType());
         assertEquals("Accept, Accept-Charset", response.getHeader(HttpHeaders.VARY));
 
         request =
@@ -457,7 +457,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_CHARSET, "iso-8859-1");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=iso-8859-1", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN  + ";charset=iso-8859-1", response.getContentType());
         assertEquals("Accept, Accept-Charset", response.getHeader(HttpHeaders.VARY));
 
         /*
@@ -471,7 +471,7 @@ public class RequestsTest extends MockSe
         request.addHeader(HttpHeaders.ACCEPT_CHARSET, "abcd");
         response = invoke(request);
         assertEquals(200, response.getStatus());
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=iso-8859-1", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN  + ";charset=iso-8859-1", response.getContentType());
         assertEquals("Accept, Accept-Charset", response.getHeader(HttpHeaders.VARY));
     }
 
@@ -534,7 +534,7 @@ public class RequestsTest extends MockSe
                                                         "/root/defaultcharset",
                                                         MediaType.TEXT_PLAIN);
         MockHttpServletResponse response = invoke(request);
-        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getContentType());
+        assertEquals(MediaType.TEXT_PLAIN, response.getContentType());
     }
 
     public void testMoreSimpleMultipleAcceptHeaders() throws Exception {

Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java Fri Apr 30 19:37:04 2010
@@ -22,7 +22,6 @@ package org.apache.wink.server.internal.
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -38,22 +37,24 @@ import org.junit.Test;
 public class ServerMediaTypeCharsetAdjusterTest extends MockObjectTestCase {
 
     RuntimeContext context = null;
-    HttpServletResponse servletResponse = null;
     DeploymentConfiguration myConfig = new DeploymentConfiguration();
+    MultivaluedMap<String, Object> responseHttpHeaders = null;
 
     
+    @SuppressWarnings("unchecked")
     @Override
     protected void setUp() throws Exception {
         super.setUp();
         
         myConfig.init();
-        // default is true in the real config  
+        // default is false in the real config  
         myConfig.setDefaultResponseCharset(true);
         // default is false in the real config  
         myConfig.setUseAcceptCharset(false);
         
         // common expectations
         context = mock(RuntimeContext.class);
+        responseHttpHeaders = mock(MultivaluedMap.class);
         checking(new Expectations() {{
             allowing(context).getAttribute(DeploymentConfiguration.class); will(returnValue(myConfig));
         }});
@@ -93,8 +94,6 @@ public class ServerMediaTypeCharsetAdjus
 
         final String expected = "application/xml";
         
-        servletResponse = mock(HttpServletResponse.class);
-        
         ServerMediaTypeCharsetAdjuster serverMediaTypeCharsetAdjuster = ServerMediaTypeCharsetAdjuster.getInstance();
         
         // switch off the default
@@ -112,16 +111,15 @@ public class ServerMediaTypeCharsetAdjus
 
         final String expected = "application/xml;charset=UTF-8";
         
-        servletResponse = mock(HttpServletResponse.class);
         checking(new Expectations() {{
-            oneOf(servletResponse).setContentType(expected);
-            oneOf(context).getAttribute(HttpServletResponse.class); will(returnValue(servletResponse));
+            oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
+            oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
         }});
         
         ServerMediaTypeCharsetAdjuster serverMediaTypeCharsetAdjuster = ServerMediaTypeCharsetAdjuster.getInstance();
         
         // empty map
-        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(new MultivaluedMapImpl<String, Object>(), MediaType.APPLICATION_XML_TYPE);
+        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(responseHttpHeaders, MediaType.APPLICATION_XML_TYPE);
         assertEquals(expected, mediaType.toString());
         
     }
@@ -132,10 +130,9 @@ public class ServerMediaTypeCharsetAdjus
         final String expected = "application/xml;charset=UTF-8";
         
         final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        servletResponse = mock(HttpServletResponse.class);
         checking(new Expectations() {{
-            oneOf(servletResponse).setContentType(expected);
-            oneOf(context).getAttribute(HttpServletResponse.class); will(returnValue(servletResponse));
+            oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
+            oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));
             oneOf(httpHeaders).getRequestHeader(HttpHeaders.ACCEPT_CHARSET); will(returnValue(null));
         }});
@@ -146,7 +143,7 @@ public class ServerMediaTypeCharsetAdjus
         myConfig.setUseAcceptCharset(true);
         
         // empty map
-        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(new MultivaluedMapImpl<String, Object>(), MediaType.APPLICATION_XML_TYPE);
+        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(responseHttpHeaders, MediaType.APPLICATION_XML_TYPE);
         assertEquals(expected, mediaType.toString());
         
     }
@@ -160,25 +157,24 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("UTF-16");
         
         final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        servletResponse = mock(HttpServletResponse.class);
         checking(new Expectations() {{
-            oneOf(servletResponse).setContentType(expected);
-            oneOf(context).getAttribute(HttpServletResponse.class); will(returnValue(servletResponse));
+            oneOf(responseHttpHeaders).add("nonesense", null);
+            oneOf(responseHttpHeaders).isEmpty(); will(returnValue(false));
+            oneOf(responseHttpHeaders).get(HttpHeaders.CONTENT_TYPE); will(returnValue(null));
+            oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));
             oneOf(httpHeaders).getRequestHeader(HttpHeaders.ACCEPT_CHARSET); will(returnValue(acceptHeaders));
         }});
         
         // non-empty map, just to make sure production code path is as expected
-        MultivaluedMap<String, Object> map = new MultivaluedMapImpl<String, Object>();
-        map.add("nonsense", null);
-
+        responseHttpHeaders.add("nonesense", null);
         ServerMediaTypeCharsetAdjuster serverMediaTypeCharsetAdjuster = ServerMediaTypeCharsetAdjuster.getInstance();
         
         // exercise code path that reads the Accept-Charset header
         myConfig.setUseAcceptCharset(true);
         
         // empty map
-        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(map, MediaType.APPLICATION_XML_TYPE);
+        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(responseHttpHeaders, MediaType.APPLICATION_XML_TYPE);
         // still defaults back to ISO-8859-1 because it is silently added as top q-valued charset on the client-originated Accept-Header.  See HTTP spec.
         assertEquals(expected, mediaType.toString());
         
@@ -193,18 +189,16 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("UTF-16;q=1.0");
         acceptHeaders.add("ISO-8859-1;q=0.5");  // re-prioritize silently added charset to lower q-value than UTF-16
         
-        final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        servletResponse = mock(HttpServletResponse.class);
         checking(new Expectations() {{
-            oneOf(servletResponse).setContentType(expected);
-            oneOf(context).getAttribute(HttpServletResponse.class); will(returnValue(servletResponse));
+            oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
+            oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
         }});
         
         ServerMediaTypeCharsetAdjuster serverMediaTypeCharsetAdjuster = ServerMediaTypeCharsetAdjuster.getInstance();
         
         // leave useAcceptHeader to the default of false
         
-        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(new MultivaluedMapImpl<String, Object>(), MediaType.APPLICATION_XML_TYPE);
+        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(responseHttpHeaders, MediaType.APPLICATION_XML_TYPE);
         // UTF-16 has highest q-value, but Accept-Charset is being ignored due to config, so...
         assertEquals(expected, mediaType.toString());
         
@@ -220,10 +214,9 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("ISO-8859-1;q=0.5");  // re-prioritize silently added charset to lower q-value than UTF-16
         
         final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        servletResponse = mock(HttpServletResponse.class);
         checking(new Expectations() {{
-            oneOf(servletResponse).setContentType(expected);
-            oneOf(context).getAttribute(HttpServletResponse.class); will(returnValue(servletResponse));
+            oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
+            oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));
             oneOf(httpHeaders).getRequestHeader(HttpHeaders.ACCEPT_CHARSET); will(returnValue(acceptHeaders));
         }});
@@ -233,7 +226,7 @@ public class ServerMediaTypeCharsetAdjus
         // exercise code path that reads the Accept-Charset header
         myConfig.setUseAcceptCharset(true);
         
-        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(new MultivaluedMapImpl<String, Object>(), MediaType.APPLICATION_XML_TYPE);
+        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(responseHttpHeaders, MediaType.APPLICATION_XML_TYPE);
         // UTF-16 has highest q-value
         assertEquals(expected, mediaType.toString());
         
@@ -249,10 +242,9 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("ISO-8859-1;q=0.5");  // re-prioritize silently added charset to lower q-value than UTF-16
         
         final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        servletResponse = mock(HttpServletResponse.class);
         checking(new Expectations() {{
-            oneOf(servletResponse).setContentType(expected);
-            oneOf(context).getAttribute(HttpServletResponse.class); will(returnValue(servletResponse));
+            oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
+            oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));
             oneOf(httpHeaders).getRequestHeader(HttpHeaders.ACCEPT_CHARSET); will(returnValue(acceptHeaders));
         }});
@@ -266,7 +258,7 @@ public class ServerMediaTypeCharsetAdjus
         // exercise code path that reads the Accept-Charset header
         myConfig.setUseAcceptCharset(true);
         
-        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(new MultivaluedMapImpl<String, Object>(), MediaType.APPLICATION_XML_TYPE);
+        MediaType mediaType = serverMediaTypeCharsetAdjuster.setDefaultCharsetOnMediaTypeHeader(responseHttpHeaders, MediaType.APPLICATION_XML_TYPE);
         // UTF-16 has highest q-value
         assertEquals(expected, mediaType.toString());
         

Modified: incubator/wink/trunk/wink-webdav/src/test/java/org/apache/wink/webdav/server/AbstractWebDAVResourcesTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-webdav/src/test/java/org/apache/wink/webdav/server/AbstractWebDAVResourcesTest.java?rev=939792&r1=939791&r2=939792&view=diff
==============================================================================
--- incubator/wink/trunk/wink-webdav/src/test/java/org/apache/wink/webdav/server/AbstractWebDAVResourcesTest.java (original)
+++ incubator/wink/trunk/wink-webdav/src/test/java/org/apache/wink/webdav/server/AbstractWebDAVResourcesTest.java Fri Apr 30 19:37:04 2010
@@ -105,7 +105,7 @@ public abstract class AbstractWebDAVReso
         Assert.assertEquals(HttpStatus.MULTI_STATUS.getCode(), response.getStatus());
         MediaType mediaType = MediaType.valueOf(response.getContentType());
         // we can't clear MediaType params due to UnsupportedOperationException on the collection, so...
-        Assert.assertEquals(MediaType.valueOf(MediaType.APPLICATION_XML_TYPE.toString() + ";charset=UTF-8"), mediaType);
+        Assert.assertEquals(MediaType.valueOf(MediaType.APPLICATION_XML_TYPE.toString()), mediaType);
         // body
         String responseContent = response.getContentAsString();
         StringReader reader = new StringReader(responseContent);
@@ -264,7 +264,7 @@ public abstract class AbstractWebDAVReso
         Assert.assertEquals(HttpStatus.OK.getCode(), response.getStatus());
         MediaType mediaType = MediaType.valueOf(response.getContentType());
         // we can't clear MediaType params due to UnsupportedOperationException on the collection, so...
-        Assert.assertEquals(MediaType.valueOf(MediaType.APPLICATION_XML_TYPE.toString() + ";charset=UTF-8"), mediaType);
+        Assert.assertEquals(MediaType.valueOf(MediaType.APPLICATION_XML_TYPE.toString()), mediaType);
         StringReader reader = new StringReader(response.getContentAsString());
         Prop prop =
             WebDAVModelHelper.unmarshal(WebDAVModelHelper.createUnmarshaller(),



Mime
View raw message