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 2026/03/03 10:58:19 UTC

(camel) branch camel-4.18.x updated (2ca60e8a2d34 -> 8a3db4790089)

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

davsclaus pushed a change to branch camel-4.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 2ca60e8a2d34 CAMEL-23123: Fix S3Presigner ignoring forcePathStyle configuration
     new 6afc860f8272 CAMEL-23115 Keep base.path it present. Otherwise use context path. (#21678)
     new 8a3db4790089 CAMEL-23115 Keep base.path it present. Otherwise use context path.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ...tyTest.java => RestApiOverrideBasePathJettyTest.java} | 16 ++++++++--------
 .../jetty/rest/RestApiOverrideHostJettyTest.java         |  8 ++++----
 .../camel-openapi-java/src/main/docs/openapi-java.adoc   |  4 ++--
 .../camel/openapi/OpenApiRestApiProcessorFactory.java    |  8 ++++----
 4 files changed, 18 insertions(+), 18 deletions(-)
 copy components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/{RestApiJettyTest.java => RestApiOverrideBasePathJettyTest.java} (85%)


(camel) 01/02: CAMEL-23115 Keep base.path it present. Otherwise use context path. (#21678)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6afc860f8272014407fde8d08702633a5ec7b846
Author: micfra <mi...@micfra.net>
AuthorDate: Tue Mar 3 11:24:37 2026 +0100

    CAMEL-23115 Keep base.path it present. Otherwise use context path. (#21678)
    
    Co-authored-by: Michael Frankfurter <mi...@hacon.de>
---
 components/camel-openapi-java/src/main/docs/openapi-java.adoc     | 4 ++--
 .../org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java  | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/components/camel-openapi-java/src/main/docs/openapi-java.adoc b/components/camel-openapi-java/src/main/docs/openapi-java.adoc
index 3c4b7a707815..38f30fb54fed 100644
--- a/components/camel-openapi-java/src/main/docs/openapi-java.adoc
+++ b/components/camel-openapi-java/src/main/docs/openapi-java.adoc
@@ -96,10 +96,10 @@ calculate the name as localhost based.
 |schemes |String |The protocol schemes to use. Multiple values can be
 separated by comma such as "http,https". The default value is "http".
 
-|base.path |String |*Required*: To set up the base path where the REST services are available.
+|base.path |String |To set up the base path where the REST services are available.
 The path is relative (e.g., do not start with http/https) and
 camel-openapi-java will calculate the absolute base path at runtime,
-which will be `protocol://host:port/context-path/base.path`
+which will be `protocol://host:port/base.path`. If the base.path option is not set, context-path will be used.
 
 |api.path |String |To set up the path where the API is available (eg /api-docs). The path is
 relative (e.g., do not start with http/https) and camel-openapi-java will
diff --git a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java
index cd7fe5b1404e..2cf18df0f1ec 100644
--- a/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java
+++ b/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestApiProcessorFactory.java
@@ -66,10 +66,10 @@ public class OpenApiRestApiProcessorFactory implements RestApiProcessorFactory {
                 options.put("schemes", scheme);
             }
         }
-        // and context path is the base.path
-        String path = configuration.getContextPath();
-        if (path != null) {
-            options.put("base.path", path);
+
+        // and context path is the base.path if option not present
+        if (!options.containsKey("base.path") && configuration.getContextPath() != null) {
+            options.put("base.path", configuration.getContextPath());
         }
 
         // is cors enabled?


(camel) 02/02: CAMEL-23115 Keep base.path it present. Otherwise use context path.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8a3db4790089a4474b8f19fbc598544c11095b71
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 3 11:55:58 2026 +0100

    CAMEL-23115 Keep base.path it present. Otherwise use context path.
---
 ...Test.java => RestApiOverrideBasePathJettyTest.java} | 18 +++++++++++-------
 .../jetty/rest/RestApiOverrideHostJettyTest.java       |  8 ++++----
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideBasePathJettyTest.java
similarity index 80%
copy from components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
copy to components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideBasePathJettyTest.java
index 773f1b45d5b7..9c76d7456d10 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideBasePathJettyTest.java
@@ -19,14 +19,14 @@ package org.apache.camel.component.jetty.rest;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.jetty.BaseJettyTest;
 import org.apache.camel.model.rest.RestParamType;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-@Disabled("Does not run well on CI due test uses JMX mbeans")
-public class RestApiOverrideHostJettyTest extends BaseJettyTest {
+@DisabledIfSystemProperty(named = "ci.env.name", matches = ".*", disabledReason = "Flaky on Github CI due to use of JMX")
+public class RestApiOverrideBasePathJettyTest extends BaseJettyTest {
 
     @Override
     protected boolean useJmx() {
@@ -35,12 +35,13 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest {
 
     @Test
     public void testApi() {
-        String out = template.requestBody("jetty:http://localhost:{{port}}/api-doc", null, String.class);
+        String out = template.requestBody("http://localhost:{{port}}/myapp/api-doc", null, String.class);
         assertNotNull(out);
+        System.out.println(out);
 
         assertTrue(out.contains("\"version\" : \"1.2.3\""));
         assertTrue(out.contains("\"title\" : \"The hello rest thing\""));
-        assertTrue(out.contains("\"host\" : \"mycoolserver/myapi\""));
+        assertTrue(out.contains("\"url\" : \"http://localhost:" + getPort() + "/cheese\""));
         assertTrue(out.contains("\"/hello/bye/{name}\""));
         assertTrue(out.contains("\"/hello/hi/{name}\""));
         assertTrue(out.contains("\"summary\" : \"To update the greeting message\""));
@@ -51,8 +52,11 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest {
         return new RouteBuilder() {
             @Override
             public void configure() {
-                restConfiguration().component("jetty").host("localhost").port(getPort()).apiContextPath("/api-doc")
-                        .apiHost("mycoolserver/myapi").apiProperty("cors", "true")
+                restConfiguration().component("jetty").host("localhost").port(getPort())
+                        .contextPath("myapp")
+                        .apiContextPath("/api-doc")
+                        .apiProperty("base.path", "cheese")
+                        .apiProperty("cors", "true")
                         .apiProperty("api.title", "The hello rest thing").apiProperty("api.version", "1.2.3");
 
                 rest("/hello").consumes("application/json").produces("application/json").get("/hi/{name}")
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
index 773f1b45d5b7..685ed6c2b32e 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/rest/RestApiOverrideHostJettyTest.java
@@ -19,13 +19,13 @@ package org.apache.camel.component.jetty.rest;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.jetty.BaseJettyTest;
 import org.apache.camel.model.rest.RestParamType;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
 
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-@Disabled("Does not run well on CI due test uses JMX mbeans")
+@DisabledIfSystemProperty(named = "ci.env.name", matches = ".*", disabledReason = "Flaky on Github CI due to use of JMX")
 public class RestApiOverrideHostJettyTest extends BaseJettyTest {
 
     @Override
@@ -35,12 +35,12 @@ public class RestApiOverrideHostJettyTest extends BaseJettyTest {
 
     @Test
     public void testApi() {
-        String out = template.requestBody("jetty:http://localhost:{{port}}/api-doc", null, String.class);
+        String out = template.requestBody("http://localhost:{{port}}/api-doc", null, String.class);
         assertNotNull(out);
 
         assertTrue(out.contains("\"version\" : \"1.2.3\""));
         assertTrue(out.contains("\"title\" : \"The hello rest thing\""));
-        assertTrue(out.contains("\"host\" : \"mycoolserver/myapi\""));
+        assertTrue(out.contains("\"url\" : \"http://mycoolserver/myapi\""));
         assertTrue(out.contains("\"/hello/bye/{name}\""));
         assertTrue(out.contains("\"/hello/hi/{name}\""));
         assertTrue(out.contains("\"summary\" : \"To update the greeting message\""));