Skip to content
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

Inconsistent path matching when two resources share a prefix #30854

Closed
kekbur opened this issue Feb 3, 2023 · 3 comments
Closed

Inconsistent path matching when two resources share a prefix #30854

kekbur opened this issue Feb 3, 2023 · 3 comments
Labels
area/rest kind/bug Something isn't working triage/duplicate This issue or pull request already exists

Comments

@kekbur
Copy link

kekbur commented Feb 3, 2023

Describe the bug

When there are two resource classes with a shared path prefix, RESTEasy Reactive incorrectly returns a 404 response. This behavior is different in RESTEasy classic, where requests to both resources return a 200 response.

@Path("/chat")
public class CollectionResource {
    @GET
    @Path("/messages")
    public String messages() {
        return "Get multiple messages";
    }
}

@Path("/chat/messages/{messageId}")
public class SingleResource {
    @GET
    public String message(@PathParam("messageId") String messageId) {
        return "Get one message: " + messageId;
    }
}

Expected behavior

I'm not sure what the correct behavior is according to JAX-RS spec. In my opinion requests to /chat/messages and /chat/messages/1 should return a 200 response with both RESTEasy Classic and RESTEasy Reactive.

Actual behavior

Request JAX-RS implementation Response
GET /chat/messages RESTEasy Reactive 404
GET /chat/messages/1 RESTEasy Reactive 200
GET /chat/messages RESTEasy Classic 200
GET /chat/messages/1 RESTEasy Classic 200

How to Reproduce?

Minimal reproducing project: code-with-quarkus.zip

Test failure:
mvn -f pom.xml clean test

Tests succeed:
mvn -f pom-resteasy-classic.xml clean test

Output of uname -a or ver

CYGWIN_NT-10.0-22000 DESKTOP-5J3QD5D 3.4.3-1.x86_64 2022-12-16 12:38 UTC x86_64 Cygwin

Output of java -version

java version "17.0.3.1" 2022-04-22 LTS Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6

Additional information

As an additional data point, the resource paths on the Quarkus 404 error page and in the dev UI.

image
image

@kekbur kekbur added the kind/bug Something isn't working label Feb 3, 2023
@gefloh
Copy link
Contributor

gefloh commented Feb 3, 2023

There are already some of these like e.g. #27154 or #30667 and it might already have been fixed with #30695.

@quarkus-bot
Copy link

quarkus-bot bot commented Feb 6, 2023

/cc @FroMage (resteasy-reactive), @Sgitario (resteasy-reactive), @stuartwdouglas (resteasy-reactive)

@geoand geoand added the triage/duplicate This issue or pull request already exists label Feb 6, 2023
@geoand
Copy link
Contributor

geoand commented Feb 6, 2023

@gefloh thanks for the detailed update on the current state of affairs!

This issue is actually a duplicate of #26496 which has not been addressed yet.

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working triage/duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants