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/0f09a862
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0f09a862
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0f09a862
Branch: refs/heads/camel-2.16.x
Commit: 0f09a8621d76f07e882cb73bab1aca4064395961
Parents: c1e0f30
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Fri Oct 9 15:56:51 2015 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Fri Oct 9 15:58:07 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/0f09a862/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 989d2ee..82f783d 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
@@ -105,16 +105,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);