cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Updating Binary provider to keep the response input stream opened if requested, default is true
Date Thu, 24 Jul 2014 14:27:25 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes d2ab3e96b -> 6d793a6a0


Updating Binary provider to keep the response input stream opened if requested, default is
true


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6d793a6a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6d793a6a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6d793a6a

Branch: refs/heads/2.7.x-fixes
Commit: 6d793a6a0b28316fa9eae1db1f0040f0ee0cd9e0
Parents: d2ab3e9
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Jul 24 16:59:04 2014 +0300
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Jul 24 17:27:03 2014 +0300

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6d793a6a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
index cf22d54..a670eb8 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
@@ -53,7 +53,7 @@ public class BinaryDataProvider<T> extends AbstractConfigurableProvider
     
     private static final int BUFFER_SIZE = 4096;
     private boolean reportByteArraySize;
-    
+    private boolean closeResponseInputStream = true;
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations,
MediaType mt) {
         return byte[].class.isAssignableFrom(type)
                || InputStream.class.isAssignableFrom(type)
@@ -140,8 +140,10 @@ public class BinaryDataProvider<T> extends AbstractConfigurableProvider
         if (isRangeSupported()) {
             Message inMessage = PhaseInterceptorChain.getCurrentMessage().getExchange().getInMessage();
             handleRangeRequest(is, os, new HttpHeadersImpl(inMessage), outHeaders);
-        } else {
+        } else if (closeResponseInputStream) {
             IOUtils.copyAndCloseInput(is, os);
+        } else {
+            IOUtils.copy(is, os);
         }
     }
     


Mime
View raw message