CAMEL-9208 - camel-netty4-http doesn't use nettyHttpBinding from URI
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae9f2910 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae9f2910 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae9f2910 Branch: refs/heads/camel-2.15.x Commit: ae9f2910ff74f53cf6f7c209218d2ba45bebe58d Parents: 44a07f9 Author: Jonathan Anstey <jans...@gmail.com> Authored: Fri Oct 9 15:56:51 2015 -0230 Committer: Jonathan Anstey <jans...@gmail.com> Committed: Fri Oct 9 15:58:21 2015 -0230 ---------------------------------------------------------------------- .../component/netty4/http/NettyHttpComponent.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ae9f2910/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java index 901ff14..87b6ed6 100644 --- a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java +++ b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/NettyHttpComponent.java @@ -104,16 +104,25 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt config.setPort(shared.getPort()); } - // create the address uri which includes the remainder parameters (which is not configuration parameters for this component) + NettyHttpBinding bindingFromUri = resolveAndRemoveReferenceParameter(parameters, "nettyHttpBinding", NettyHttpBinding.class); + + // create the address uri which includes the remainder parameters (which + // is not configuration parameters for this component) URI u = new URI(UnsafeUriCharactersEncoder.encodeHttpURI(remaining)); - + String addressUri = URISupport.createRemainingURI(u, parameters).toString(); NettyHttpEndpoint answer = new NettyHttpEndpoint(addressUri, this, config); - // must use a copy of the binding on the endpoint to avoid sharing same instance that can cause side-effects + // must use a copy of the binding on the endpoint to avoid sharing same + // instance that can cause side-effects if (answer.getNettyHttpBinding() == null) { - Object binding = getNettyHttpBinding(); + Object binding = null; + if (bindingFromUri != null) { + binding = bindingFromUri; + } else { + binding = getNettyHttpBinding(); + } if (binding instanceof RestNettyHttpBinding) { NettyHttpBinding copy = ((RestNettyHttpBinding) binding).copy(); answer.setNettyHttpBinding(copy);