allthingssecurity commented on PR #28377:
URL: https://github.com/apache/camel/pull/28377#issuecomment-6382441439
@davsclaus addressed in 7d0c76c147bf.
**Blocker (doc build):** the upgrade guide entry now uses passthroughs,
`+/api/{name}+` and `+/users/{id}+`. I checked the whole entry; the guide is
the only adoc file this PR changes, and no other `{...}` is left inside
backticks.
**Plain-first vs rest-dsl first:** changed to rest-dsl first, as you suggest.
- `DefaultUndertowHost`: the server now calls the `RestRootHandler` first. A
request that no rest-dsl consumer matches goes to its new fallback, the
`CamelRootHandler` of the plain endpoints, instead of getting 404/405 there.
- The default handler of the `CamelRootHandler` (no plain endpoint matches
either) is now `RestRootHandler.handleNoMatch`. It gives the same answers as
before: 404 "No matching path found", or 405 when a rest-dsl consumer has the
path with another method.
- Per-consumer security wrapping is unchanged, since each consumer still
wraps its own handler before registration. The server still stops only when
both kinds are gone.
- `RestUndertowAndPlainConsumerSamePortTest`:
`testPlainCatchAllOnRootAndRestApiAreBothServed` replaces the test that
asserted the catch-all wins. With a plain `matchOnUriPrefix=true` on `/`:
- `/users/123` and `/api/orders/1` reach the rest-dsl consumers;
- `/plain` reaches its plain endpoint;
- `/index.html` and `/users/123/unknown` reach the catch-all;
- after the catch-all stops, `/unknown` gets 404.
- Two more tests: `testRestTemplateComesBeforeAnOverlappingPlainPath` and
`testRestMethodNotAllowedWithoutCatchAll` (`DELETE /users/123` still gets 405).
- Both new routing tests fail with the previous head 282a60905ef7 and pass
now. camel-undertow: 243 run, 0 failures, 1 skipped.
There is one case where rest-dsl first changes who wins: a plain path that
is more specific than an overlapping rest-dsl template, such as a plain
`/users/me` next to rest-dsl `/users/{id}`. The rest-dsl consumer now gets
`/users/me`. I kept rest-dsl first anyway, because the overlap is only on the
paths the template matches and does not hide a whole API. The upgrade note says
so and tells users to give the plain endpoint another path or port, and the
test above covers it.
**Non-blocking (static `/api` as template default):** this already happens
on ports with only plain endpoints, so I left it alone. With rest-dsl first,
`GET /api/orders/1` in your example now goes to the rest-dsl consumer anyway. I
added a line about it to the PR description edits.
_Claude Code on behalf of allthingssecurity_
--
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]