cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1153258 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Date Tue, 02 Aug 2011 19:56:35 GMT
Author: sergeyb
Date: Tue Aug  2 19:56:35 2011
New Revision: 1153258

URL: http://svn.apache.org/viewvc?rev=1153258&view=rev
Log:
[CXF-3703] Minor update to WebClient to avoid overriding Content-Type for GET requests

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1153258&r1=1153257&r2=1153258&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Tue
Aug  2 19:56:35 2011
@@ -650,12 +650,10 @@ public class WebClient extends AbstractC
                                 Class<?> responseClass, Type outGenericType) {
         
         MultivaluedMap<String, String> headers = getHeaders();
-        if (body != null) {
-            if (headers.getFirst(HttpHeaders.CONTENT_TYPE) == null) {
-                headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_TYPE.toString());
-            }
-        } else {
-            headers.putSingle(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD);
+        boolean contentTypeNotSet = headers.getFirst(HttpHeaders.CONTENT_TYPE) == null;
+        if (contentTypeNotSet) {
+            String ct = body != null ? MediaType.APPLICATION_XML_TYPE.toString() : "*/*";
+            headers.putSingle(HttpHeaders.CONTENT_TYPE, ct);
         }
         if (responseClass != null && headers.getFirst(HttpHeaders.ACCEPT) == null)
{
             headers.putSingle(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML_TYPE.toString());



Mime
View raw message