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

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new e3cfca07f73 docs(platform-http): document context-path interaction 
with server.servlet.context-path
e3cfca07f73 is described below

commit e3cfca07f73fb966ba22f17f77e309785d29fc55
Author: croway <[email protected]>
AuthorDate: Wed Sep 16 10:58:30 2026 +0200

    docs(platform-http): document context-path interaction with 
server.servlet.context-path
    
    camel.rest.context-path only prefixes rest() DSL routes, while Spring
    Boot's server.servlet.context-path prefixes every platform-http request
    including plain platform-http: consumer routes. The two stack, but this
    wasn't documented anywhere and was only verifiable via
    SpringBootPlatformHttpContextPathTest.
---
 .../src/main/docs/platform-http.adoc               | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git 
a/components-starter/camel-platform-http-starter/src/main/docs/platform-http.adoc
 
b/components-starter/camel-platform-http-starter/src/main/docs/platform-http.adoc
index 33336123259..3205f05652b 100644
--- 
a/components-starter/camel-platform-http-starter/src/main/docs/platform-http.adoc
+++ 
b/components-starter/camel-platform-http-starter/src/main/docs/platform-http.adoc
@@ -17,6 +17,39 @@ carry no matrix parameters. A request to 
`/greeting/John%20Doe;v=1` sets the `na
 The `CamelHttpPath` header is not affected: it reports the raw request path, 
with the servlet context-path
 removed.
 
+== Context path
+
+Two independent properties can prefix the path a request is matched against, 
and they stack rather than
+being alternatives:
+
+* `server.servlet.context-path` - the standard Spring Boot property. It 
applies to every request handled by
+  the embedded servlet container, so it prefixes both `rest()` DSL routes and 
plain `platform-http:` consumer
+  routes.
+* `camel.rest.context-path` - a Camel `RestConfiguration` property. It only 
prefixes routes defined with the
+  `rest()` DSL; it has no effect on a route consuming directly from a 
`platform-http:` endpoint.
+
+When both are set, the effective path is 
`{server.servlet.context-path}{camel.rest.context-path}{route path}`.
+For example, with:
+
+[source,properties]
+----
+server.servlet.context-path=/test
+camel.rest.context-path=/api
+----
+
+and the routes:
+
+[source,java]
+----
+rest("/message").get("/{param}").to("direct:messageByParam");
+
+from("platform-http:/greeting/{name}")
+        .transform().simple("Hello ${header.name}");
+----
+
+the REST DSL route is served at `/test/api/message/{param}`, while the plain 
`platform-http:` route is served
+at `/test/greeting/{name}` - `camel.rest.context-path` is not applied to it.
+
 == File uploads
 
 Every accepted multipart file upload is copied out of the servlet container 
into the servlet temporary directory

Reply via email to