You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/07/25 13:00:52 UTC
[2/2] camel git commit: CAMEL-10181: Camel-undertow:
UndertowHttpBinding should be initialized in the endpoint and not at
component level
CAMEL-10181: Camel-undertow: UndertowHttpBinding should be initialized in the endpoint and not at component level
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e0758221
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e0758221
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e0758221
Branch: refs/heads/master
Commit: e07582215f682f56c85114819606014af08bf7b6
Parents: 91a7a02
Author: Andrea Cosentino <an...@gmail.com>
Authored: Mon Jul 25 14:10:35 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Mon Jul 25 14:33:33 2016 +0200
----------------------------------------------------------------------
components/camel-undertow/src/main/docs/undertow.adoc | 4 ++++
.../camel/component/undertow/UndertowComponent.java | 11 +++++++++--
.../camel/component/undertow/UndertowEndpoint.java | 8 ++++++--
3 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e0758221/components/camel-undertow/src/main/docs/undertow.adoc
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/docs/undertow.adoc b/components/camel-undertow/src/main/docs/undertow.adoc
index 275b5ad..b82a5c4 100644
--- a/components/camel-undertow/src/main/docs/undertow.adoc
+++ b/components/camel-undertow/src/main/docs/undertow.adoc
@@ -40,6 +40,8 @@ Options
^^^^^^^
+
+
// component options: START
The Undertow component supports 2 options which are listed below.
@@ -57,6 +59,8 @@ The Undertow component supports 2 options which are listed below.
+
+
// endpoint options: START
The Undertow component supports 17 endpoint options which are listed below:
http://git-wip-us.apache.org/repos/asf/camel/blob/e0758221/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
index f9677f6..a7fac90 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
public class UndertowComponent extends UriEndpointComponent implements RestConsumerFactory, RestApiConsumerFactory {
private static final Logger LOG = LoggerFactory.getLogger(UndertowEndpoint.class);
- private UndertowHttpBinding undertowHttpBinding = new DefaultUndertowHttpBinding();
+ private UndertowHttpBinding undertowHttpBinding;
private final Map<Integer, UndertowRegistry> serversRegistry = new HashMap<Integer, UndertowRegistry>();
private SSLContextParameters sslContextParameters;
@@ -78,7 +78,14 @@ public class UndertowComponent extends UriEndpointComponent implements RestConsu
UndertowEndpoint endpoint = createEndpointInstance(endpointUri, this);
// set options from component
endpoint.setSslContextParameters(sslContextParameters);
- endpoint.setUndertowHttpBinding(undertowHttpBinding);
+ // Prefer endpoint configured over component configured
+ if (undertowHttpBinding == null) {
+ // fallback to component configured
+ undertowHttpBinding = getUndertowHttpBinding();
+ }
+ if (undertowHttpBinding != null) {
+ endpoint.setUndertowHttpBinding(undertowHttpBinding);
+ }
// set options from parameters
setProperties(endpoint, parameters);
if (options != null) {
http://git-wip-us.apache.org/repos/asf/camel/blob/e0758221/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
index ce71dea..b4dfcaf 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowEndpoint.java
@@ -61,7 +61,7 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint,
@UriParam(label = "advanced")
private UndertowHttpBinding undertowHttpBinding;
@UriParam(label = "advanced")
- private HeaderFilterStrategy headerFilterStrategy;
+ private HeaderFilterStrategy headerFilterStrategy = new UndertowHeaderFilterStrategy();
@UriParam(label = "security")
private SSLContextParameters sslContextParameters;
@UriParam(label = "consumer")
@@ -179,7 +179,6 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint,
*/
public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) {
this.headerFilterStrategy = headerFilterStrategy;
- undertowHttpBinding.setHeaderFilterStrategy(headerFilterStrategy);
}
public SSLContextParameters getSslContextParameters() {
@@ -218,6 +217,11 @@ public class UndertowEndpoint extends DefaultEndpoint implements AsyncEndpoint,
}
public UndertowHttpBinding getUndertowHttpBinding() {
+ if (undertowHttpBinding == null) {
+ // create a new binding and use the options from this endpoint
+ undertowHttpBinding = new DefaultUndertowHttpBinding();
+ undertowHttpBinding.setHeaderFilterStrategy(getHeaderFilterStrategy());
+ }
return undertowHttpBinding;
}