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

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new 6e7e488  CAMEL-12514 Extract undertow component name into standalone 
method
6e7e488 is described below

commit 6e7e488e30bf2d850b5570a5b8464829e29b6992
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      | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 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 0075a17..4f105b8 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
@@ -166,7 +166,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();
@@ -202,7 +202,7 @@ public class UndertowComponent extends DefaultComponent 
implements RestConsumerF
 
         Map<String, Object> map = new HashMap<String, Object>();
         // 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());
@@ -232,9 +232,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
@@ -271,7 +271,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;
         }
@@ -296,7 +296,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());
@@ -373,4 +373,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