CAMEL-24577: platform-http path variables follow the path Spring matched - #1932
Open
Croway wants to merge 1 commit into
Open
CAMEL-24577: platform-http path variables follow the path Spring matched#1932Croway wants to merge 1 commit into
Croway wants to merge 1 commit into
Conversation
oscerd
approved these changes
Sep 2, 2026
Croway
force-pushed
the
CAMEL-24577-platform-http-path-variables
branch
from
September 2, 2026 13:12
0aade04 to
bca151d
Compare
Contributor
Author
|
The CI failure here is Claude Code on behalf of Federico Mariani |
SpringBootPlatformHttpBinding evaluated the rest placeholders of the consumer path against getRawPath(request), which is the undecoded request URI with the context-path removed. Spring dispatched the request against the parsed RequestPath, whose segments are percent-decoded and stripped of matrix parameters, so the header could disagree with the path the request was matched on: /greeting/%61dmin set name to "%61dmin" while Spring matched "admin", and /greeting/name;v=1 set name to "name;v=1". The placeholders are now evaluated against the segments Spring matched, taken from ServletRequestPathUtils.parse(request), which also aligns the starter with the vertx engine, where the path params are decoded. The path is parsed rather than read back from the request attribute Spring caches, because the consumer services the request on its own executor and the dispatch may already have removed the attribute, which would make the value depend on timing. getRawPath() is unchanged, so Exchange.HTTP_PATH still reports the raw path and the context-path handling of CAMEL-22116 and CAMEL-23191 is preserved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Croway
force-pushed
the
CAMEL-24577-platform-http-path-variables
branch
from
September 2, 2026 16:57
bca151d to
cf1907f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CAMEL-24577
What
SpringBootPlatformHttpBinding.populateRequestParameters()evaluated the rest placeholders of the consumerpath against
getRawPath(request), which isrequest.getRequestURI()with the servlet context-path removed:still percent-encoded and still carrying matrix parameters.
Spring dispatched the request against the parsed
RequestPath, whose segments are decoded and stripped ofmatrix parameters, so the header could disagree with the path the request was matched on. For a consumer
platform-http:/greeting/{name}:namebeforenamenow/greeting/%61dmin%61dminadmin/greeting/John%20DoeJohn%20DoeJohn Doe/greeting/name;v=1name;v=1nameThis also brings the starter in line with the vertx engine, which sets the decoded
RoutingContext.pathParams()values.
How
Only the placeholder evaluation changed. It now uses
ServletRequestPathUtils.parse(request)and joins thesegments of
pathWithinApplication()by theirvalueToMatch()- the very values Spring matched the patternagainst - falling back to the raw path if the request cannot be parsed.
The path is parsed rather than read back from the
RequestPathSpring cached in the request attribute: theconsumer services the request on its own executor, and the dispatch that cached it may have removed the
attribute by then, which would make the header value depend on timing.
getRawPath()is untouched, soExchange.HTTP_PATH(CamelHttpPath) still reports the raw path with thecontext-path removed, and the overrides added by CAMEL-22116 and CAMEL-23191 keep working.
populateRequestParametersnow checks the consumer path for placeholders before computing the path, so aconsumer without placeholders does no extra work.
Behaviour change
Path variable headers for percent-encoded segments or segments with matrix parameters change as shown above.
An application that decoded the header itself, or parsed matrix parameters out of it, must drop that handling.
Requests whose path variables contain neither are unaffected. An upgrade guide entry will be proposed
separately in
apache/camel.Tests
SpringBootPlatformHttpPathVariableTest: plain, percent-encoded, encoded space, matrix parameter, andREST DSL path variables, each also asserting
CamelHttpPathis unchanged. Four of the five fail withoutthe fix.
SpringBootPlatformHttpBindingPathVariableTest: services the consumer directly, with no dispatch havingcached a request path, pinning that resolution does not depend on that attribute.
camel-platform-http-startersuite green (53 test classes).Documentation: a "Path variables" section was added to the starter docs.
Claude Code (Opus 5) on behalf of Federico Mariani