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

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


The following commit(s) were added to refs/heads/html by this push:
     new a1cbbca15ab CAMEL-21110: Add support for serving static content in 
embedded main HTTP server
a1cbbca15ab is described below

commit a1cbbca15ab76fc37779d148537f10b16bf35326
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Sep 2 16:45:06 2024 +0200

    CAMEL-21110: Add support for serving static content in embedded main HTTP 
server
---
 .../main/camel-main-configuration-metadata.json      |  1 +
 .../HttpServerConfigurationPropertiesConfigurer.java |  6 ++++++
 .../META-INF/camel-main-configuration-metadata.json  |  1 +
 core/camel-main/src/main/docs/main.adoc              |  3 ++-
 .../main/HttpServerConfigurationProperties.java      | 20 ++++++++++++++------
 5 files changed, 24 insertions(+), 7 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 0e3bc2db744..a4e6e092707 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
@@ -274,6 +274,7 @@
     { "name": "camel.server.metricsEnabled", "description": "Whether to enable 
metrics. If enabled then you can access metrics on context-path: \/q\/metrics", 
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties", 
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.server.path", "description": "Context-path to use for 
embedded HTTP server", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "\/" },
     { "name": "camel.server.port", "description": "Port to use for binding 
embedded HTTP server", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 8080 },
+    { "name": "camel.server.staticContextPath", "description": "The 
context-path to use for serving static content. By default, the root path is 
used. And if there is an index.html page then this is automatically loaded.", 
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties", 
"type": "string", "javaType": "java.lang.String", "defaultValue": "\/" },
     { "name": "camel.server.staticEnabled", "description": "Whether serving 
static files is enabled. If enabled then Camel can host html\/js and other web 
files that makes it possible to include small web applications.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.server.uploadEnabled", "description": "Whether to enable 
file upload via HTTP (not intended for production use). This functionality is 
for development to be able to reload Camel routes and code with source changes 
(if reload is enabled). If enabled then you can upload\/delete files via HTTP 
PUT\/DELETE on context-path: \/q\/upload\/{name}. You must also configure the 
uploadSourceDir option.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "t [...]
     { "name": "camel.server.uploadSourceDir", "description": "Source directory 
when upload is enabled.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
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 cdbb53d1a0d..af40d20036f 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
@@ -53,6 +53,8 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         case "metricsEnabled": target.setMetricsEnabled(property(camelContext, 
boolean.class, value)); return true;
         case "path": target.setPath(property(camelContext, 
java.lang.String.class, value)); return true;
         case "port": target.setPort(property(camelContext, int.class, value)); 
return true;
+        case "staticcontextpath":
+        case "staticContextPath": 
target.setStaticContextPath(property(camelContext, java.lang.String.class, 
value)); return true;
         case "staticenabled":
         case "staticEnabled": target.setStaticEnabled(property(camelContext, 
boolean.class, value)); return true;
         case "uploadenabled":
@@ -98,6 +100,8 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         case "metricsEnabled": return boolean.class;
         case "path": return java.lang.String.class;
         case "port": return int.class;
+        case "staticcontextpath":
+        case "staticContextPath": return java.lang.String.class;
         case "staticenabled":
         case "staticEnabled": return boolean.class;
         case "uploadenabled":
@@ -144,6 +148,8 @@ public class HttpServerConfigurationPropertiesConfigurer 
extends org.apache.came
         case "metricsEnabled": return target.isMetricsEnabled();
         case "path": return target.getPath();
         case "port": return target.getPort();
+        case "staticcontextpath":
+        case "staticContextPath": return target.getStaticContextPath();
         case "staticenabled":
         case "staticEnabled": return target.isStaticEnabled();
         case "uploadenabled":
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 0e3bc2db744..a4e6e092707 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
@@ -274,6 +274,7 @@
     { "name": "camel.server.metricsEnabled", "description": "Whether to enable 
metrics. If enabled then you can access metrics on context-path: \/q\/metrics", 
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties", 
"type": "boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.server.path", "description": "Context-path to use for 
embedded HTTP server", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "defaultValue": "\/" },
     { "name": "camel.server.port", "description": "Port to use for binding 
embedded HTTP server", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer", 
"javaType": "int", "defaultValue": 8080 },
+    { "name": "camel.server.staticContextPath", "description": "The 
context-path to use for serving static content. By default, the root path is 
used. And if there is an index.html page then this is automatically loaded.", 
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties", 
"type": "string", "javaType": "java.lang.String", "defaultValue": "\/" },
     { "name": "camel.server.staticEnabled", "description": "Whether serving 
static files is enabled. If enabled then Camel can host html\/js and other web 
files that makes it possible to include small web applications.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.server.uploadEnabled", "description": "Whether to enable 
file upload via HTTP (not intended for production use). This functionality is 
for development to be able to reload Camel routes and code with source changes 
(if reload is enabled). If enabled then you can upload\/delete files via HTTP 
PUT\/DELETE on context-path: \/q\/upload\/{name}. You must also configure the 
uploadSourceDir option.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "t [...]
     { "name": "camel.server.uploadSourceDir", "description": "Source directory 
when upload is enabled.", "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 1c4479facdb..84338b63325 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -170,7 +170,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 21 options, which are listed below.
+The camel.server supports 22 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
@@ -192,6 +192,7 @@ The camel.server supports 21 options, which are listed 
below.
 | *camel.server.metricsEnabled* | Whether to enable metrics. If enabled then 
you can access metrics on context-path: /q/metrics | false | boolean
 | *camel.server.path* | Context-path to use for embedded HTTP server | / | 
String
 | *camel.server.port* | Port to use for binding embedded HTTP server | 8080 | 
int
+| *camel.server.staticContextPath* | The context-path to use for serving 
static content. By default, the root path is used. And if there is an 
index.html page then this is automatically loaded. | / | String
 | *camel.server.staticEnabled* | Whether serving static files is enabled. If 
enabled then Camel can host html/js and other web files that makes it possible 
to include small web applications. | false | boolean
 | *camel.server.uploadEnabled* | Whether to enable file upload via HTTP (not 
intended for production use). This functionality is for development to be able 
to reload Camel routes and code with source changes (if reload is enabled). If 
enabled then you can upload/delete files via HTTP PUT/DELETE on context-path: 
/q/upload/\{name}. You must also configure the uploadSourceDir option. | false 
| boolean
 | *camel.server.uploadSourceDir* | Source directory when upload is enabled. |  
| 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 4e8b11e945e..96d5e0128b6 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
@@ -159,8 +159,8 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
     }
 
     /**
-     * Whether serving static files is enabled. If enabled then Camel can host 
html/js and other web files
-     * that makes it possible to include small web applications.
+     * Whether serving static files is enabled. If enabled then Camel can host 
html/js and other web files that makes it
+     * possible to include small web applications.
      */
     public void setStaticEnabled(boolean staticEnabled) {
         this.staticEnabled = staticEnabled;
@@ -170,6 +170,14 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
         return staticContextPath;
     }
 
+    /**
+     * The context-path to use for serving static content. By default, the 
root path is used. And if there is an
+     * index.html page then this is automatically loaded.
+     */
+    public void setStaticContextPath(String staticContextPath) {
+        this.staticContextPath = staticContextPath;
+    }
+
     public boolean isDevConsoleEnabled() {
         return devConsoleEnabled;
     }
@@ -380,8 +388,8 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
     }
 
     /**
-     * Whether serving static files is enabled. If enabled then Camel can host 
html/js and other web files
-     * that makes it possible to include small web applications.
+     * Whether serving static files is enabled. If enabled then Camel can host 
html/js and other web files that makes it
+     * possible to include small web applications.
      */
     public HttpServerConfigurationProperties withStaticEnabled(boolean 
staticEnabled) {
         this.staticEnabled = staticEnabled;
@@ -389,8 +397,8 @@ public class HttpServerConfigurationProperties implements 
BootstrapCloseable {
     }
 
     /**
-     * The context-path to use for serving static content. By default, the 
root path is used.
-     * And if there is an index.html page then this is automatically loaded.
+     * The context-path to use for serving static content. By default, the 
root path is used. And if there is an
+     * index.html page then this is automatically loaded.
      */
     public HttpServerConfigurationProperties withStaticContextPath(String 
staticContextPath) {
         this.staticContextPath = staticContextPath;

Reply via email to