This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 4525d2e  CAMEL-12514 Extract undertow component name into standalone 
method
4525d2e is described below

commit 4525d2e07b3636ce0abf9cfe45c0d857b6d1ac4e
Author: Hynek Mlnarik <hmlna...@redhat.com>
AuthorDate: Tue May 15 14:06:50 2018 +0200

    CAMEL-12514 Extract undertow component name into standalone method
---
 .../camel/component/undertow/UndertowComponent.java  | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

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 f1de36e..4da4188 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
@@ -165,7 +165,7 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
 
         RestConfiguration config = configuration;
         if (config == null) {
-            config = camelContext.getRestConfiguration("undertow", true);
+            config = camelContext.getRestConfiguration(getComponentName(), 
true);
         }
         if (config.getScheme() != null) {
             scheme = config.getScheme();
@@ -201,7 +201,7 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
 
         Map<String, Object> map = new HashMap<>();
         // build query string, and append any endpoint configuration properties
-        if (config.getComponent() == null || 
config.getComponent().equals("undertow")) {
+        if (config.getComponent() == null || 
config.getComponent().equals(getComponentName())) {
             // setup endpoint options
             if (config.getEndpointProperties() != null && 
!config.getEndpointProperties().isEmpty()) {
                 map.putAll(config.getEndpointProperties());
@@ -231,9 +231,9 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
 
         String url;
         if (api) {
-            url = 
"undertow:%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s";
+            url = getComponentName() + 
":%s://%s:%s/%s?matchOnUriPrefix=true&httpMethodRestrict=%s";
         } else {
-            url = 
"undertow:%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s";
+            url = getComponentName() + 
":%s://%s:%s/%s?matchOnUriPrefix=false&httpMethodRestrict=%s";
         }
 
         // get the endpoint
@@ -270,7 +270,7 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
         uriTemplate = FileUtil.stripLeadingSeparator(uriTemplate);
 
         // get the endpoint
-        String url = "undertow:" + host;
+        String url = getComponentName() + ":" + host;
         if (!ObjectHelper.isEmpty(basePath)) {
             url += "/" + basePath;
         }
@@ -280,12 +280,12 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
         
         RestConfiguration config = configuration;
         if (config == null) {
-            config = camelContext.getRestConfiguration("undertow", true);
+            config = camelContext.getRestConfiguration(getComponentName(), 
true);
         }
 
         Map<String, Object> map = new HashMap<>();
         // build query string, and append any endpoint configuration properties
-        if (config.getComponent() == null || 
config.getComponent().equals("undertow")) {
+        if (config.getComponent() == null || 
config.getComponent().equals(getComponentName())) {
             // setup endpoint options
             if (config.getEndpointProperties() != null && 
!config.getEndpointProperties().isEmpty()) {
                 map.putAll(config.getEndpointProperties());
@@ -315,7 +315,7 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
     protected void doStart() throws Exception {
         super.doStart();
 
-        RestConfiguration config = 
getCamelContext().getRestConfiguration("undertow", true);
+        RestConfiguration config = 
getCamelContext().getRestConfiguration(getComponentName(), true);
         // configure additional options on undertow configuration
         if (config.getComponentProperties() != null && 
!config.getComponentProperties().isEmpty()) {
             setProperties(this, config.getComponentProperties());
@@ -392,4 +392,8 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
     public ComponentVerifier getVerifier() {
         return (scope, parameters) -> 
getExtension(ComponentVerifierExtension.class).orElseThrow(UnsupportedOperationException::new).verify(scope,
 parameters);
     }
+
+    protected String getComponentName() {
+        return "undertow";
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
acosent...@apache.org.

Reply via email to