CAMEL-8821 merged the patch into camel-http4
Conflicts:
components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
Conflicts:
components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/221218c1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/221218c1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/221218c1
Branch: refs/heads/camel-2.14.x
Commit: 221218c162dbf37137c6dfef8eb46032a1f8cadb
Parents: 7eb4e0a
Author: Willem Jiang <[email protected]>
Authored: Sun May 31 11:10:58 2015 +0800
Committer: Willem Jiang <[email protected]>
Committed: Sun May 31 17:25:48 2015 +0800
----------------------------------------------------------------------
.../camel/component/http4/DefaultHttpBinding.java | 10 +++++-----
.../apache/camel/component/http4/helper/HttpHelper.java | 12 ++++++++++--
2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/221218c1/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
----------------------------------------------------------------------
diff --git
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
index b447558..00e13a9 100644
---
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
+++
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
@@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory;
/**
* Binding between {@link HttpMessage} and {@link HttpServletResponse}.
*
- * @version
+ * @version
*/
public class DefaultHttpBinding implements HttpBinding {
@@ -86,7 +86,7 @@ public class DefaultHttpBinding implements HttpBinding {
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Object value = request.getHeader(name);
- // mapping the content-type
+ // mapping the content-type
if (name.toLowerCase().equals("content-type")) {
name = Exchange.CONTENT_TYPE;
}
@@ -157,7 +157,7 @@ public class DefaultHttpBinding implements HttpBinding {
}
}
Boolean flag = message.getHeader(Exchange.SKIP_WWW_FORM_URLENCODED,
Boolean.class);
- boolean skipWwwFormUrlEncoding = flag != null ? flag : false;
+ boolean skipWwwFormUrlEncoding = flag != null ? flag : false;
if (request.getMethod().equals("POST") && request.getContentType() !=
null
&&
request.getContentType().startsWith(HttpConstants.CONTENT_TYPE_WWW_FORM_URLENCODED)
&& !skipWwwFormUrlEncoding) {
@@ -283,7 +283,7 @@ public class DefaultHttpBinding implements HttpBinding {
}
}
}
-
+
protected boolean isText(String contentType) {
if (contentType != null) {
String temp = contentType.toLowerCase();
@@ -293,7 +293,7 @@ public class DefaultHttpBinding implements HttpBinding {
}
return false;
}
-
+
protected void copyStream(InputStream is, OutputStream os) throws
IOException {
try {
// copy directly from input stream to output stream
http://git-wip-us.apache.org/repos/asf/camel/blob/221218c1/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
----------------------------------------------------------------------
diff --git
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
index 5610d6a..951dd0e 100644
---
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
+++
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
@@ -39,6 +39,7 @@ import org.apache.camel.component.http4.HttpMessage;
import org.apache.camel.component.http4.HttpMethods;
import org.apache.camel.component.http4.HttpServletUrlRewrite;
import org.apache.camel.converter.stream.CachedOutputStream;
+import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.URISupport;
@@ -145,8 +146,15 @@ public final class HttpHelper {
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);
@@ -233,7 +241,7 @@ public final class HttpHelper {
*
* @param exchange the exchange
* @return the created method
- * @throws URISyntaxException
+ * @throws URISyntaxException
*/
public static HttpMethods createMethod(Exchange exchange, HttpEndpoint
endpoint, boolean hasPayload) throws URISyntaxException {
// is a query string provided in the endpoint URI or in a header
(header