You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/08/29 07:04:48 UTC

[1/2] git commit: CAMEL-7757 Fix the EOFException in camel-restlet with thanks to Sandeep

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 <wi...@gmail.com>
Authored: Thu Aug 28 14:31:15 2014 +0800
Committer: Willem Jiang <wi...@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


[2/2] git commit: CAMEL-7757 Fix the EOFException in camel-restlet with thanks to Sandeep

Posted by ni...@apache.org.
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/ad962478
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ad962478
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ad962478

Branch: refs/heads/camel-2.12.x
Commit: ad9624787ccacd232c6edeeb158c1d0321a90e4b
Parents: 986ebbd
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Aug 28 14:31:15 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Aug 29 13:04:22 2014 +0800

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


http://git-wip-us.apache.org/repos/asf/camel/blob/ad962478/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