-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
ContainerResponseFilter not invoked for not found urls #40331
Comments
/cc @FroMage (resteasy-reactive), @stuartwdouglas (resteasy-reactive) |
@phillip-kruger this seems to have broke as part of #39897 |
I'll have a look |
🙏🏼 |
Ok, so what we have here is what was described in the PR: #37680 From that PR description: Breaking change (with a workaround if needed) In the current version, if you have a JAX-RS Filter, that filter will run, even in the case that the requested resource was not a REST resource (in my opinion, that is wrong). This will not happen anymore. Filters for JAX-RS will now only run on JAX-RS resources. In the case that you want your Filters to also run on non JAX-RS resource, you need to add your own ExceptionMapper: package io.quarkus.resteasy.reactive.server.test.customproviders;
import jakarta.ws.rs.NotFoundException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
@Provider
public class NotFoundExeptionMapper implements ExceptionMapper<NotFoundException> {
@Override
public Response toResponse(NotFoundException exception) {
return Response.status(404).build();
}
} Now, JAX-RS becomes responsible for the Not Found resources, and the Filter will run. In the current version where this always happens, it makes it impossible for other extensions to handle Not Found. |
So |
I agree that the previous behavior was wrong
+1 |
@phillip-kruger should we add something to the migration guide and close this? |
Makes sense. Thanks for looking into it |
Thanks @phillip-kruger |
Describe the bug
Hello,
after migrating from 3.8.x to 3.9.x response filter annotated with
@Provider
is not called anymore if the response is 404This was working in 3.8.x and before with resteasy reactive extension.
Expected behavior
ContainerResponseFilter is not invoked for 404 responses
Actual behavior
ContainerResponseFilter should also work for 404 responses
How to Reproduce?
code-with-quarkus.tar.gz
Run
GreetingResourceTest
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: