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 2015/05/31 05:11:38 UTC
[2/2] camel git commit: CAMEL-8821 Support to disable the stream
caching in camel-servlet from the camel context
CAMEL-8821 Support to disable the stream caching in camel-servlet from the camel context
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/23a07e5f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/23a07e5f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/23a07e5f
Branch: refs/heads/master
Commit: 23a07e5fed5e1183be9d046c5e298ee75cc152ab
Parents: be73f1a
Author: Willem Jiang <wi...@gmail.com>
Authored: Sun May 31 11:10:42 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Sun May 31 11:11:26 2015 +0800
----------------------------------------------------------------------
.../apache/camel/component/http/DefaultHttpBinding.java | 2 +-
.../apache/camel/component/http/helper/HttpHelper.java | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/23a07e5f/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java b/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
index 6617f70..97c81c0 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
@@ -457,7 +457,7 @@ public class DefaultHttpBinding implements HttpBinding {
return null;
}
}
- // reade the response body from servlet request
+ // read the response body from servlet request
return HttpHelper.readResponseBodyFromServletRequest(request, httpMessage.getExchange());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/23a07e5f/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
index c7cce00..edee4b4 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
@@ -42,6 +42,7 @@ import org.apache.camel.component.http.HttpMethods;
import org.apache.camel.component.http.HttpServletUrlRewrite;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.converter.stream.CachedOutputStream;
+import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.util.CamelObjectInputStream;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
@@ -179,9 +180,14 @@ public final class HttpHelper {
if (is == null) {
return null;
}
-
+ boolean disableStreamCaching = false;
+ // Just take the consideration of the setting of Camel Context StreamCaching
+ if (exchange.getContext() instanceof DefaultCamelContext) {
+ DefaultCamelContext context = (DefaultCamelContext) exchange.getContext();
+ disableStreamCaching = !context.isStreamCaching();
+ }
// convert the input stream to StreamCache if the stream cache is not disabled
- if (exchange.getProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, Boolean.FALSE, Boolean.class)) {
+ if (exchange.getProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, disableStreamCaching, Boolean.class)) {
return is;
} else {
CachedOutputStream cos = new CachedOutputStream(exchange);