You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/05/03 05:53:01 UTC
[camel] 01/07: CAMEL-18026: dev console for camel-platform-http
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 6b663e925f5c627fe8e627cc13f46e7aef9a81a0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 3 07:12:46 2022 +0200
CAMEL-18026: dev console for camel-platform-http
---
.../component/platform/http/vertx/VertxPlatformHttpRouter.java | 1 -
.../apache/camel/component/platform/http/PlatformHttpConsole.java | 5 ++++-
.../camel/component/platform/http/spi/PlatformHttpEngine.java | 6 ++++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java
index 0df41432f56..2e3e17ba980 100644
--- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java
+++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpRouter.java
@@ -22,7 +22,6 @@ import java.util.Map;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpMethod;
-import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.ext.web.AllowForwardHeaders;
import io.vertx.ext.web.Route;
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 50d5aadd363..4afcfa7e3f5 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
@@ -36,8 +36,11 @@ public class PlatformHttpConsole extends AbstractDevConsole {
PlatformHttpComponent http = getCamelContext().getComponent("platform-http", PlatformHttpComponent.class);
if (http != null) {
+ String server = "http://0.0.0.0";
int port = http.getEngine().getServerPort();
- String server = "http://0.0.0.0:" + port;
+ if (port > 0) {
+ server += ":" + port;
+ }
Set<HttpEndpointModel> models = http.getHttpEndpoints();
for (HttpEndpointModel model : models) {
if (model.getVerbs() != null) {
diff --git a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
index af5e7cc57b2..c5a6e52ceb5 100644
--- a/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
+++ b/components/camel-platform-http/src/main/java/org/apache/camel/component/platform/http/spi/PlatformHttpEngine.java
@@ -35,8 +35,10 @@ public interface PlatformHttpEngine {
Consumer createConsumer(PlatformHttpEndpoint platformHttpEndpoint, Processor processor);
/**
- * The port number the HTTP server is using
+ * The port number the HTTP server is using, if possible to determine.
*/
- int getServerPort();
+ default int getServerPort() {
+ return 0;
+ }
}