Croway opened a new pull request, #1959: URL: https://github.com/apache/camel-spring-boot/pull/1959
Cherry-pick of #1932 onto `camel-spring-boot-4.22.x`. **Original PR:** #1932 — platform-http path variables follow the path Spring matched **JIRA:** [CAMEL-24577](https://issues.apache.org/jira/browse/CAMEL-24577) ### What it fixes `SpringBootPlatformHttpBinding` resolved the `{placeholder}` values of a `platform-http` consumer's path against `getRawPath(request)` — the undecoded request URI with the context path stripped off. Spring, however, dispatches the request against its own parsed `RequestPath`, whose segments are percent-decoded and have any matrix parameters removed. When the two disagreed, the header exposed to the route did not match what Spring actually matched: a request to `/greeting/%61dmin` was routed to the `admin` value but the header carried the raw `%61dmin`, and `/greeting/name;v=1` carried `name;v=1` instead of `name`. The fix evaluates the placeholders against the segments Spring matched, obtained via `ServletRequestPathUtils.parse(request)`, instead of the raw request path. This also brings the Spring MVC engine's behavior in line with the vertx platform-http engine, which already decodes path parameters. The path is parsed fresh rather than read from the `RequestPath` attribute Spring caches on the request, because the platform-http consumer services the request on its own executor and by the time it runs, Spring's dispatch may have already cleared that attribute — reading it back would make correctness depend on timing. `getRawPath()` itself is untouched, so `Exchange.HTTP_PATH` still reports the raw path, preserving the context-path handling from CAMEL-22116 and CAMEL-23191. ### Verification on this branch - The cherry-pick (`git cherry-pick -x`) applied with a clean auto-merge (no conflict markers) on top of this branch's current tip — the task brief anticipated a possible conflict with the CAMEL-24496 backport on the same file, but that backport (#1953) is still an open, unmerged PR at the time of this backport, so there was nothing in `origin`'s actual history to conflict with. - Both cherry-picked test files compiled and ran as-is: this branch already matches `main`'s test conventions here (`org.apache.camel.test.spring.junit6.CamelSpringBootTest`, and `SpringBootPlatformHttpConsumer.service()` returning `CompletableFuture<Void>`), so no adaptation was needed (unlike the 4.18.x backport, which required fixing both of those for that branch's older conventions). - Ran `../../mvnw verify` in `components-starter/camel-platform-http-starter` (against the module built with its parent/`camel-version` temporarily repointed to the released 4.22.0, since the branch's 4.22.1-SNAPSHOT parent isn't published, plus the same repoint for the literal `org.apache.camel` core SNAPSHOT versions in `tooling/camel-spring-boot-dependencies/pom.xml`): a first run showed `SpringBootPlatformHttpRequestTimeoutTest.testGetAsync` failing all 3 surefire attempts with `IllegalStateException: The response object has been recycled...`. I reproduced the identical failure on this branch's tip *before* the cherry-pick as well when running the full suite, then re-ran the full suite on both the pre-cherry-pick tip and the cherry-picked branch again and got a clean pass both times (123 unit tests + 11 integration tests, 0 failures), and the test also passes reliably in isolation on both. This points to a load/timing-sensitive flake in that timeout test unrelated to this change — the change here doesn't touch response timeout/writing logic at all — rather than a regression caused by this cherry-pick. - `mvn install -pl components-starter/camel-platform-http-starter -am -DskipTests -Dfastinstall` built cleanly. The temporary parent/`camel-version` and dependencies-pom edits, plus any catalog regeneration artifacts, were reverted before pushing; the pushed commit touches only the same files as the original PR. _Claude Code on behalf of Federico Mariani_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
