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


The following commit(s) were added to refs/heads/main by this push:
     new ccfd793f5e5 CAMEL-21848: camel-jbang - Add jolokia when using 
--console to make it easier for tooling to trouble-shoot with camel-jbang
ccfd793f5e5 is described below

commit ccfd793f5e5ed42805b54da30bab467100c19090
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Mar 7 12:45:58 2025 +0100

    CAMEL-21848: camel-jbang - Add jolokia when using --console to make it 
easier for tooling to trouble-shoot with camel-jbang
---
 .../main/camel-main-configuration-metadata.json    |  1 +
 .../http/main/DefaultMainHttpServerFactory.java    |  1 +
 .../platform/http/main/MainHttpServer.java         | 20 ++++++++++++---
 ...ttpServerConfigurationPropertiesConfigurer.java |  7 ++++++
 .../camel-main-configuration-metadata.json         |  1 +
 core/camel-main/src/main/docs/main.adoc            |  3 ++-
 .../main/HttpServerConfigurationProperties.java    | 29 ++++++++++++++++++++++
 7 files changed, 58 insertions(+), 4 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index b44a19c20c4..c1c986ef4c7 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -286,6 +286,7 @@
     { "name": "camel.server.host", "description": "Hostname to use for binding 
embedded HTTP server", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "0.0.0.0" },
     { "name": "camel.server.infoEnabled", "description": "Whether to enable 
info console. If enabled then you can see some basic Camel information at 
\/q\/info", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.server.jolokiaEnabled", "description": "Whether to enable 
jolokia. If enabled then you can access jolokia api on context-path: 
\/q\/jolokia", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.server.jolokiaPath", "description": "The path endpoint 
used to expose the jolokia data.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "\/q\/jolokia" },
     { "name": "camel.server.jwtKeystorePassword", "description": "Password 
from the keystore used for JWT tokens validation.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.server.jwtKeystorePath", "description": "Path to the 
keystore file used for JWT tokens validation.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.server.jwtKeystoreType", "description": "Type of the 
keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
diff --git 
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
 
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
index 7daae15af58..2a96b201f09 100644
--- 
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
+++ 
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/DefaultMainHttpServerFactory.java
@@ -73,6 +73,7 @@ public class DefaultMainHttpServerFactory implements 
CamelContextAware, MainHttp
         server.setHealthCheckEnabled(configuration.isHealthCheckEnabled());
         server.setHealthPath(configuration.getHealthPath());
         server.setJolokiaEnabled(configuration.isJolokiaEnabled());
+        server.setJolokiaPath(configuration.getJolokiaPath());
         server.setMetricsEnabled(configuration.isMetricsEnabled());
         server.setUploadEnabled(configuration.isUploadEnabled());
         server.setUploadSourceDir(configuration.getUploadSourceDir());
diff --git 
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
 
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
index 9713fc87416..d2853a7d442 100644
--- 
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
+++ 
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
@@ -134,6 +134,7 @@ public class MainHttpServer extends ServiceSupport 
implements CamelContextAware,
     private boolean downloadEnabled;
     private boolean sendEnabled;
     private String healthPath;
+    private String jolokiaPath;
 
     @Override
     public CamelContext getCamelContext() {
@@ -239,6 +240,7 @@ public class MainHttpServer extends ServiceSupport 
implements CamelContextAware,
         this.jolokiaEnabled = jolokiaEnabledEnabled;
     }
 
+    @ManagedAttribute(description = "The context-path for serving health check 
status")
     public String getHealthPath() {
         return healthPath;
     }
@@ -250,6 +252,18 @@ public class MainHttpServer extends ServiceSupport 
implements CamelContextAware,
         this.healthPath = healthPath;
     }
 
+    @ManagedAttribute(description = "The context-path for serving Jolokia 
data")
+    public String getJolokiaPath() {
+        return jolokiaPath;
+    }
+
+    /**
+     * The path endpoint used to expose the Jolokia data.
+     */
+    public void setJolokiaPath(String jolokiaPath) {
+        this.jolokiaPath = jolokiaPath;
+    }
+
     @ManagedAttribute(description = "Whether metrics is enabled")
     public boolean isMetricsEnabled() {
         return metricsEnabled;
@@ -298,7 +312,7 @@ public class MainHttpServer extends ServiceSupport 
implements CamelContextAware,
         this.downloadEnabled = downloadEnabled;
     }
 
-    @ManagedAttribute(description = "Whether send message is enabled  
(q/send)")
+    @ManagedAttribute(description = "Whether send message is enabled (q/send)")
     public boolean isSendEnabled() {
         return sendEnabled;
     }
@@ -805,14 +819,14 @@ public class MainHttpServer extends ServiceSupport 
implements CamelContextAware,
                 .orElseThrow(() -> new RuntimeException(
                         "JolokiaPlatformHttpPlugin not found. Please add 
camel-platform-http-jolokia dependency."));
 
-        Route jolokia = router.route("/q/jolokia/*");
+        Route jolokia = router.route(jolokiaPath + "/*");
         jolokia.method(HttpMethod.GET);
         jolokia.method(HttpMethod.POST);
 
         Handler<RoutingContext> handler = (Handler<RoutingContext>) 
jolokiaPlugin.getHandler();
         jolokia.handler(new BlockingHandlerDecorator(handler, true));
 
-        platformHttpComponent.addHttpEndpoint("/q/jolokia", "GET,POST", null,
+        platformHttpComponent.addHttpEndpoint(jolokiaPath, "GET,POST", null,
                 "text/plain,application/json", null);
     }
 
diff --git 
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
 
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
index e47a448a491..897a6c11006 100644
--- 
a/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
+++ 
b/core/camel-main/src/generated/java/org/apache/camel/main/HttpServerConfigurationPropertiesConfigurer.java
@@ -35,6 +35,7 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         map.put("Host", java.lang.String.class);
         map.put("InfoEnabled", boolean.class);
         map.put("JolokiaEnabled", boolean.class);
+        map.put("JolokiaPath", java.lang.String.class);
         map.put("JwtKeystorePassword", java.lang.String.class);
         map.put("JwtKeystorePath", java.lang.String.class);
         map.put("JwtKeystoreType", java.lang.String.class);
@@ -79,6 +80,8 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         case "infoEnabled": target.setInfoEnabled(property(camelContext, 
boolean.class, value)); return true;
         case "jolokiaenabled":
         case "jolokiaEnabled": target.setJolokiaEnabled(property(camelContext, 
boolean.class, value)); return true;
+        case "jolokiapath":
+        case "jolokiaPath": target.setJolokiaPath(property(camelContext, 
java.lang.String.class, value)); return true;
         case "jwtkeystorepassword":
         case "jwtKeystorePassword": 
target.setJwtKeystorePassword(property(camelContext, java.lang.String.class, 
value)); return true;
         case "jwtkeystorepath":
@@ -139,6 +142,8 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         case "infoEnabled": return boolean.class;
         case "jolokiaenabled":
         case "jolokiaEnabled": return boolean.class;
+        case "jolokiapath":
+        case "jolokiaPath": return java.lang.String.class;
         case "jwtkeystorepassword":
         case "jwtKeystorePassword": return java.lang.String.class;
         case "jwtkeystorepath":
@@ -195,6 +200,8 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         case "infoEnabled": return target.isInfoEnabled();
         case "jolokiaenabled":
         case "jolokiaEnabled": return target.isJolokiaEnabled();
+        case "jolokiapath":
+        case "jolokiaPath": return target.getJolokiaPath();
         case "jwtkeystorepassword":
         case "jwtKeystorePassword": return target.getJwtKeystorePassword();
         case "jwtkeystorepath":
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index b44a19c20c4..c1c986ef4c7 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -286,6 +286,7 @@
     { "name": "camel.server.host", "description": "Hostname to use for binding 
embedded HTTP server", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "0.0.0.0" },
     { "name": "camel.server.infoEnabled", "description": "Whether to enable 
info console. If enabled then you can see some basic Camel information at 
\/q\/info", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.server.jolokiaEnabled", "description": "Whether to enable 
jolokia. If enabled then you can access jolokia api on context-path: 
\/q\/jolokia", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.server.jolokiaPath", "description": "The path endpoint 
used to expose the jolokia data.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "\/q\/jolokia" },
     { "name": "camel.server.jwtKeystorePassword", "description": "Password 
from the keystore used for JWT tokens validation.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.server.jwtKeystorePath", "description": "Path to the 
keystore file used for JWT tokens validation.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.server.jwtKeystoreType", "description": "Type of the 
keystore used for JWT tokens validation (jks, pkcs12, etc.).", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index b6be0a3d36d..21b00562ecc 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -187,7 +187,7 @@ The camel.routecontroller supports 12 options, which are 
listed below.
 
 
 === Camel Embedded HTTP Server (only for standalone; not Spring Boot or 
Quarkus) configurations
-The camel.server supports 26 options, which are listed below.
+The camel.server supports 27 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
@@ -205,6 +205,7 @@ The camel.server supports 26 options, which are listed 
below.
 | *camel.server.host* | Hostname to use for binding embedded HTTP server | 
0.0.0.0 | String
 | *camel.server.infoEnabled* | Whether to enable info console. If enabled then 
you can see some basic Camel information at /q/info | false | boolean
 | *camel.server.jolokiaEnabled* | Whether to enable jolokia. If enabled then 
you can access jolokia api on context-path: /q/jolokia | false | boolean
+| *camel.server.jolokiaPath* | The path endpoint used to expose the jolokia 
data. | /q/jolokia | String
 | *camel.server.jwtKeystore{zwsp}Password* | Password from the keystore used 
for JWT tokens validation. |  | String
 | *camel.server.jwtKeystorePath* | Path to the keystore file used for JWT 
tokens validation. |  | String
 | *camel.server.jwtKeystoreType* | Type of the keystore used for JWT tokens 
validation (jks, pkcs12, etc.). |  | String
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
index 33f5afa81a5..23ee307b674 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/HttpServerConfigurationProperties.java
@@ -70,6 +70,8 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
 
     @Metadata(defaultValue = "/q/health")
     private String healthPath = "/q/health";
+    @Metadata(defaultValue = "/q/jolokia")
+    private String jolokiaPath = "/q/jolokia";
 
     public HttpServerConfigurationProperties(MainConfigurationProperties 
parent) {
         this.parent = parent;
@@ -270,6 +272,17 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
         this.healthPath = healthPath;
     }
 
+    public String getJolokiaPath() {
+        return jolokiaPath;
+    }
+
+    /**
+     * The path endpoint used to expose the jolokia data.
+     */
+    public void setJolokiaPath(String jolokiaPath) {
+        this.jolokiaPath = jolokiaPath;
+    }
+
     public boolean isUploadEnabled() {
         return uploadEnabled;
     }
@@ -604,4 +617,20 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
         return this;
     }
 
+    /**
+     * The path endpoint used to expose the health status
+     */
+    public HttpServerConfigurationProperties withHealthPath(String healthPath) 
{
+        this.healthPath = healthPath;
+        return this;
+    }
+
+    /**
+     * The path endpoint used to expose the jolokia data.
+     */
+    public HttpServerConfigurationProperties withJolokiaPath(String 
jolokiaPath) {
+        this.jolokiaPath = jolokiaPath;
+        return this;
+    }
+
 }

Reply via email to