Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B3E9F178C4 for ; Wed, 8 Oct 2014 14:29:59 +0000 (UTC) Received: (qmail 24403 invoked by uid 500); 8 Oct 2014 14:29:59 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 24331 invoked by uid 500); 8 Oct 2014 14:29:59 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 24318 invoked by uid 99); 8 Oct 2014 14:29:59 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Oct 2014 14:29:59 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4691892383A; Wed, 8 Oct 2014 14:29:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Wed, 08 Oct 2014 14:30:01 -0000 Message-Id: <338373be59944ce6a4163ff0a132b7f1@git.apache.org> In-Reply-To: <8dd6237857fa468b8255b103d5101fc0@git.apache.org> References: <8dd6237857fa468b8255b103d5101fc0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Wed Oct 8 21:36:30 2014 +0800 Committer: Willem Jiang 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()); }