camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [3/7] git commit: CAMEL-7896 merged the patch into camel-netty4-http module
Date Thu, 09 Oct 2014 02:34:05 GMT
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/d0ad4b36
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d0ad4b36
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d0ad4b36

Branch: refs/heads/camel-2.14.x
Commit: d0ad4b3683cd5f872cb6710c87e6831e35158021
Parents: 581e96f
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Wed Oct 8 21:36:30 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Thu Oct 9 10:31:48 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/d0ad4b36/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());
     }


Mime
View raw message