Repository: camel Updated Branches: refs/heads/master a94f95b61 -> c8c2a930b
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/866a3995 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/866a3995 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/866a3995 Branch: refs/heads/master Commit: 866a3995002d3033cca2413142e6725900fe7b5e Parents: 2f88e14 Author: Willem Jiang <willem.ji...@gmail.com> Authored: Thu Aug 28 14:31:15 2014 +0800 Committer: Willem Jiang <willem.ji...@gmail.com> Committed: Thu Aug 28 14:49:53 2014 +0800 ---------------------------------------------------------------------- .../component/restlet/DefaultRestletBinding.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/866a3995/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 cd57867..98db3c7 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 @@ -310,13 +310,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