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/10/08 16:30:01 UTC
[3/4] git commit: CAMEL-7896 merged the patch into camel-netty4-http
module
CAMEL-7896 merged the patch into camel-netty4-http module
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c05e47fa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c05e47fa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c05e47fa
Branch: refs/heads/master
Commit: c05e47fa0b2f3c2a41d65623fef469a614de4df9
Parents: 08a6621
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Oct 8 21:36:30 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Oct 8 21:36:30 2014 +0800
----------------------------------------------------------------------
.../netty4/http/handlers/HttpClientChannelHandler.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c05e47fa/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
index f2bc20c..6657c24 100644
--- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
+++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/handlers/HttpClientChannelHandler.java
@@ -18,9 +18,10 @@ package org.apache.camel.component.netty4.http.handlers;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpResponse;
-
+import io.netty.handler.codec.http.HttpHeaders;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
+import org.apache.camel.component.netty4.NettyConstants;
import org.apache.camel.component.netty4.handlers.ClientChannelHandler;
import org.apache.camel.component.netty4.http.NettyHttpProducer;
@@ -40,6 +41,10 @@ public class HttpClientChannelHandler extends ClientChannelHandler {
@Override
protected Message getResponseMessage(Exchange exchange, ChannelHandlerContext ctx, Object message) throws Exception {
FullHttpResponse response = (FullHttpResponse) message;
+ if (!HttpHeaders.isKeepAlive(response)) {
+ // just want to make sure we close the channel if the keepAlive is not true
+ exchange.setProperty(NettyConstants.NETTY_CLOSE_CHANNEL_WHEN_COMPLETE, true);
+ }
// use the binding
return producer.getEndpoint().getNettyHttpBinding().toCamelMessage(response, exchange, producer.getConfiguration());
}