You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/03/21 18:31:30 UTC

[camel] 04/06: CAMEL-19176: camel-platform-http - Add listener for added/removed http endpoints

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

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

commit c490e53d194182e138f81afca2303443d3ea9595
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 21 17:09:09 2023 +0100

    CAMEL-19176: camel-platform-http - Add listener for added/removed http endpoints
---
 .../platform/http/PlatformHttpComponent.java          | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
index 8c0ec93e2ed..994c0911d49 100644
--- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
+++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpComponent.java
@@ -86,10 +86,8 @@ public class PlatformHttpComponent extends DefaultComponent implements RestConsu
             throws Exception {
 
         // reuse the createConsumer method we already have. The api need to use GET and match on uri prefix
-        Consumer consumer = doCreateConsumer(camelContext, processor, "GET", contextPath, null, null, null, configuration,
+        return doCreateConsumer(camelContext, processor, "GET", contextPath, null, null, null, configuration,
                 parameters, true);
-        addHttpEndpoint(contextPath, "GET", consumer);
-        return consumer;
     }
 
     @Override
@@ -98,19 +96,8 @@ public class PlatformHttpComponent extends DefaultComponent implements RestConsu
             String uriTemplate,
             String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters)
             throws Exception {
-        Consumer consumer
-                = doCreateConsumer(camelContext, processor, verb, basePath, uriTemplate, consumes, produces, configuration,
-                        parameters, false);
-        if (uriTemplate != null) {
-            if (uriTemplate.startsWith("/")) {
-                addHttpEndpoint(basePath + uriTemplate, verb, consumer);
-            } else {
-                addHttpEndpoint(basePath + "/" + uriTemplate, verb, consumer);
-            }
-        } else {
-            addHttpEndpoint(basePath, verb, consumer);
-        }
-        return consumer;
+        return doCreateConsumer(camelContext, processor, verb, basePath, uriTemplate, consumes, produces, configuration,
+                parameters, false);
     }
 
     /**