cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1509864 - /cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
Date Fri, 02 Aug 2013 21:12:34 GMT
Author: sergeyb
Date: Fri Aug  2 21:12:34 2013
New Revision: 1509864

URL: http://svn.apache.org/r1509864
Log:
Auto-closing async response only if a property is set

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

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1509864&r1=1509863&r2=1509864&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Fri Aug
 2 21:12:34 2013
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.jaxrs.client;
 
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
@@ -983,8 +982,8 @@ public class WebClient extends AbstractC
         if (r == null) {
             try {
                 r = handleResponse(message.getExchange().getOutMessage(),
-                                            cb.getResponseClass(),
-                                            cb.getOutGenericType());
+                                   cb.getResponseClass(),
+                                   cb.getOutGenericType());
             } catch (Throwable t) {
                 cb.handleException(message, t);
                 return;
@@ -994,15 +993,14 @@ public class WebClient extends AbstractC
             cb.handleResponse(message, new Object[] {r});
         } else if (r.getStatus() >= 300) {
             cb.handleException(message, convertToWebApplicationException(r));
-            closeResponseIfPossible(r);
         } else {
             cb.handleResponse(message, new Object[] {r.getEntity()});
-            closeResponseIfPossible(r);
+            closeAsyncResponseIfPossible(r, message, cb);
         }
     }
     
-    private void closeResponseIfPossible(Response r) {
-        if (!(r.getEntity() instanceof InputStream)) {
+    private void closeAsyncResponseIfPossible(Response r, Message outMessage, JaxrsClientCallback<?>
cb) {
+        if (responseStreamCanBeClosed(outMessage, cb.getResponseClass())) {
             r.close();
         }
     }



Mime
View raw message