Repository: camel
Updated Branches:
  refs/heads/camel-2.12.x 986ebbdc1 -> ad9624787
  refs/heads/camel-2.13.x 637aa4dfe -> 4ce44057d


CAMEL-7757 Fix the EOFException in camel-restlet with thanks to Sandeep


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4ce44057
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4ce44057
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4ce44057

Branch: refs/heads/camel-2.13.x
Commit: 4ce44057def813594228d6ffa27336d293fe248d
Parents: 637aa4d
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Thu Aug 28 14:31:15 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Fri Aug 29 13:02:29 2014 +0800

----------------------------------------------------------------------
 .../component/restlet/DefaultRestletBinding.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4ce44057/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
----------------------------------------------------------------------
diff --git 
a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
 
b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
index ebef445..cd3d62d 100644
--- 
a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
+++ 
b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/DefaultRestletBinding.java
@@ -299,13 +299,17 @@ public class DefaultRestletBinding implements 
RestletBinding, HeaderFilterStrate
             // get content type
             MediaType mediaType = response.getEntity().getMediaType();
             if (mediaType != null) {
+                LOG.debug("Setting the Content-Type to be {}",  
mediaType.toString());
                 exchange.getOut().setHeader(Exchange.CONTENT_TYPE, 
mediaType.toString());
             }
-
-            // get content text
-            String text = response.getEntity().getText();
-            LOG.debug("Populate exchange from Restlet response: {}", text);
-            exchange.getOut().setBody(text);
+            if (mediaType != null && 
mediaType.equals(MediaType.APPLICATION_OCTET_STREAM)) {
+                exchange.getOut().setBody(response.getEntity().getStream());
+            } else {
+                // get content text
+                String text = response.getEntity().getText();
+                LOG.debug("Populate exchange from Restlet response: {}", text);
+                exchange.getOut().setBody(text);
+            }
         }
 
         // preserve headers from in by copying any non existing headers

Reply via email to