camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [1/2] camel git commit: CAMEL-10181: Camel-undertow: UndertowHttpBinding should be initialized in the endpoint and not at component level
Date Mon, 25 Jul 2016 12:59:08 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 6aa84254f -> 052807ad2


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/6df702ce
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6df702ce
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6df702ce

Branch: refs/heads/camel-2.17.x
Commit: 6df702ce6074dcbe3d5452201241477b53e31169
Parents: 6aa8425
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Mon Jul 25 14:10:35 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Mon Jul 25 14:35:18 2016 +0200

----------------------------------------------------------------------
 .../camel/component/undertow/UndertowComponent.java      | 11 +++++++++--
 .../camel/component/undertow/UndertowEndpoint.java       |  8 ++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6df702ce/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 65771f2..a43979b 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/6df702ce/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 9111ecd..f71da15 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
@@ -60,7 +60,7 @@ public class UndertowEndpoint extends DefaultEndpoint implements HeaderFilterStr
     @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")
@@ -178,7 +178,6 @@ public class UndertowEndpoint extends DefaultEndpoint implements HeaderFilterStr
      */
     public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) {
         this.headerFilterStrategy = headerFilterStrategy;
-        undertowHttpBinding.setHeaderFilterStrategy(headerFilterStrategy);
     }
 
     public SSLContextParameters getSslContextParameters() {
@@ -217,6 +216,11 @@ public class UndertowEndpoint extends DefaultEndpoint implements HeaderFilterStr
     }
 
     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;
     }
 


Mime
View raw message