This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch man in repository https://gitbox.apache.org/repos/asf/camel.git
commit de96f05c311aacce394b37d72f3fb41afd9292be Author: Claus Ibsen <[email protected]> AuthorDate: Tue Jul 29 18:23:23 2025 +0200 CAMEL-22285: platform-http-main - Dev consoles should be registered as management endpoints --- .../component/platform/http/PlatformHttpConsole.java | 20 +++++++++++++++++--- .../core/commands/process/ListPlatformHttp.java | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsole.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsole.java index 898537976b2..edb1358419c 100644 --- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsole.java +++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/PlatformHttpConsole.java @@ -45,6 +45,7 @@ public class PlatformHttpConsole extends AbstractDevConsole { if (port > 0) { server += ":" + port; } + sb.append("Endpoints:\n"); Set<HttpEndpointModel> models = http.getHttpEndpoints(); for (HttpEndpointModel model : models) { if (model.getVerbs() != null) { @@ -53,6 +54,15 @@ public class PlatformHttpConsole extends AbstractDevConsole { sb.append(String.format(" %s%s\n", server, model.getUri())); } } + sb.append("\nManagement Endpoints:\n"); + models = http.getHttpManagementEndpoints(); + for (HttpEndpointModel model : models) { + if (model.getVerbs() != null) { + sb.append(String.format(" %s%s (%s)\n", server, model.getUri(), model.getVerbs())); + } else { + sb.append(String.format(" %s%s\n", server, model.getUri())); + } + } } return sb.toString(); @@ -73,17 +83,21 @@ public class PlatformHttpConsole extends AbstractDevConsole { } root.put("server", server); - final List<JsonObject> list = buildEndpointList(http, server); + List<JsonObject> list = buildEndpointList(http, server, false); if (!list.isEmpty()) { root.put("endpoints", list); } + list = buildEndpointList(http, server, true); + if (!list.isEmpty()) { + root.put("managementEndpoints", list); + } } return root; } - private static List<JsonObject> buildEndpointList(PlatformHttpComponent http, String server) { - Set<HttpEndpointModel> models = http.getHttpEndpoints(); + private static List<JsonObject> buildEndpointList(PlatformHttpComponent http, String server, boolean management) { + Set<HttpEndpointModel> models = management ? http.getHttpManagementEndpoints() : http.getHttpEndpoints(); List<JsonObject> list = new ArrayList<>(); for (HttpEndpointModel model : models) { JsonObject jo = new JsonObject(); diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListPlatformHttp.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListPlatformHttp.java index da757cbd940..76a5826e891 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListPlatformHttp.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListPlatformHttp.java @@ -45,6 +45,10 @@ public class ListPlatformHttp extends ProcessWatchCommand { description = "Sort by pid, name or age", defaultValue = "pid") String sort; + @CommandLine.Option(names = { "--all" }, + description = "Include management endpoints") + boolean all; + public ListPlatformHttp(CamelJBangMain main) { super(main); } @@ -90,6 +94,22 @@ public class ListPlatformHttp extends ProcessWatchCommand { rows.add(row); } } + if (all) { + arr = (JsonArray) jo.get("managementEndpoints"); + if (arr != null) { + for (int i = 0; i < arr.size(); i++) { + row = row.copy(); + jo = (JsonObject) arr.get(i); + row.server = server; + row.url = jo.getString("url"); + row.path = jo.getString("path"); + row.verbs = jo.getString("verbs"); + row.consumes = jo.getString("consumes"); + row.produces = jo.getString("produces"); + rows.add(row); + } + } + } } } });
