cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1162904 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Date Mon, 29 Aug 2011 17:19:29 GMT
Author: sergeyb
Date: Mon Aug 29 17:19:29 2011
New Revision: 1162904

URL: http://svn.apache.org/viewvc?rev=1162904&view=rev
Log:
[CXF-3760] Setting Accept:*/* in case of void

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

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1162904&r1=1162903&r2=1162904&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Mon Aug 29 17:19:29 2011
@@ -299,11 +299,18 @@ public class ClientProxyImpl extends Abs
         
         List<MediaType> accepts = getAccept(headers);
         if (accepts == null) {
-            accepts = InjectionUtils.isPrimitive(responseClass) 
-                ? Collections.singletonList(MediaType.TEXT_PLAIN_TYPE)
-                : ori.getProduceTypes().size() == 0 
-                || ori.getProduceTypes().get(0).equals(MediaType.WILDCARD_TYPE) 
-                ? Collections.singletonList(MediaType.APPLICATION_XML_TYPE) : ori.getProduceTypes();
+            boolean produceWildcard = ori.getProduceTypes().size() == 0 
+                || ori.getProduceTypes().get(0).equals(MediaType.WILDCARD_TYPE);
+            if (produceWildcard) {
+                accepts = InjectionUtils.isPrimitive(responseClass)
+                    ? Collections.singletonList(MediaType.TEXT_PLAIN_TYPE)
+                    : Collections.singletonList(MediaType.APPLICATION_XML_TYPE);        
+            } else if (responseClass == Void.class) {
+                accepts = Collections.singletonList(MediaType.WILDCARD_TYPE);
+            } else {
+                accepts = ori.getProduceTypes();
+            }
+            
             for (MediaType mt : accepts) {
                 headers.add(HttpHeaders.ACCEPT, mt.toString());
             }



Mime
View raw message