cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1509756 - /cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Date Fri, 02 Aug 2013 16:10:37 GMT
Author: sergeyb
Date: Fri Aug  2 16:10:36 2013
New Revision: 1509756

URL: http://svn.apache.org/r1509756
Log:
[CXF-5144] Closing response stream only if 'response.stream.auto.close' property is enabled

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

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1509756&r1=1509755&r2=1509756&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java (original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java Fri
Aug  2 16:10:36 2013
@@ -513,7 +513,7 @@ public abstract class AbstractClient imp
             } catch (Exception ex) {
                 reportMessageHandlerProblem("MSG_READER_PROBLEM", cls, contentType, ex, r);
             } finally {
-                if (cls != InputStream.class && inputStream != null) {
+                if (inputStream != null && responseStreamCanBeClosed(outMessage,
cls)) {
                     try {
                         inputStream.close();
                     } catch (IOException ex) { 
@@ -527,6 +527,10 @@ public abstract class AbstractClient imp
         return null;                                                
     }
     
+    private boolean responseStreamCanBeClosed(Message outMessage, Class<?> cls) {
+        return MessageUtils.isTrue(outMessage.getContextualProperty("response.stream.auto.close"));
+    }
+    
     protected void completeExchange(Object response, Exchange exchange, boolean proxy) {
         // higher level conduits such as FailoverTargetSelector need to
         // clear the request state but a fair number of response objects 



Mime
View raw message