-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Support overlapping paths on resource classes #47386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clever, well done!
@FroMage do you also want to take a look at this?
...e/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
Outdated
Show resolved
Hide resolved
cc @franz1981 as this one could potentially have a slight performance impact |
I have added few comments |
...e/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
Outdated
Show resolved
Hide resolved
...e/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Please @geoand wait to merge this till the comments are addressed or at least a round of profiling is performed 🙏 |
That's why I removed the |
...e/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
Outdated
Show resolved
Hide resolved
...e/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
@franz1981 PTAL |
I would suggest to just return the match without allocating any list, but just the top match 🙏 |
This comment has been minimized.
This comment has been minimized.
@franz1981 no worries, I don't mind the back and forth as long as its not too nitpicky :) |
I now return an Iterator, which allows to try the next match. |
Status for workflow
|
Having partially matching paths on resource classes could lead to 404s, even though a matching resource method existed.
Lets take the example from #26496.
Calling
GET /base/123
would result in a 404./base/{id}
is a perfect match for that request, which result in theExtension
resource class being used.Quarkus-rest always only works on the basis of one resource class - the one with the best match.
I however believe that is not up to spec.
https://jakarta.ee/specifications/restful-ws/4.0/jakarta-restful-ws-spec-4.0.pdf
Chapter 3.5.2 Request Matching
Stage 1 only handles matching of the resource class path to the request uri -> both classes match.
Stage 2 figures out which of all resource methods in all matched resource classes matches against the request uri.
So basically, the current implementation results in Stage 1 only reporting one matching resource class, altough it should report 2.
This PR adds additional logic, so that all matching resource classes are remembered, and the handler chain is restarted if the current resource class does not contain a matchin sub resource method, or sub resource locator.
405 Method Not Allowed
#26496