-
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
Range response status reset when using a @ServerResponseFilter
#45791
Comments
/cc @maxandersen (jbang), @quarkusio/devtools (jbang) |
Could you please create a Maven reproduce that I can use to run the application and see the problem in action? Thanks |
The reproducer is the jbang script: //usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.quarkus.platform:quarkus-bom:3.17.7@pom
//DEPS io.quarkus:quarkus-rest
//JAVAC_OPTIONS -parameters
//JAVA_OPTIONS -Djava.util.logging.manager=org.jboss.logmanager.LogManager
import java.io.File;
import org.jboss.resteasy.reactive.server.ServerResponseFilter;
import io.quarkus.runtime.Quarkus;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.container.ContainerResponseContext;
@Path("/hello")
@ApplicationScoped
public class QuarkusApp {
@GET
public File sayHello() {
return new File("/home/quarkus/data");
}
public static void main(String[] args) {
Quarkus.run(args);
}
@ServerResponseFilter
public void responseHeaders(ContainerResponseContext responseContext) {
System.out.println(responseContext.getEntity());
}
} |
I know, but I would really like a Maven project along with a sample data file that triggers the issue |
The data file is anything, could be a text file, or a binary file, it doesn't matter. |
What size is needed? I tried with a small one and couldn't reproduce the problem |
|
TY |
This will require some thought on how to address it |
Describe the bug
When returning a
File
Quarkus should use theServerFileBodyHandler
that supportsRange
requests:quarkus/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/providers/serialisers/ServerFileBodyHandler.java
Lines 41 to 64 in 85eb353
It works fine until I access the response from a
@ServerResponseFilter
where the response status is reset to200
instead of the206
:The
ServerFileBodyHandler
sets the status code to PARTIAL_CONTENT (206).setStatusCode(Response.Status.PARTIAL_CONTENT.getStatusCode())
, but the filter is messing up this status (without even changing anything) and reset it to OK 200.Expected behavior
The 206 Partial Content code should be present.
Actual behavior
The 200 OK code is used instead.
How to Reproduce?
Run the QuarkusApp jbang script.
Comment the
System.out.println(responseContext.getEntity());
line, and it returns 206, uncomment and it returns 200.Any access to the response object resets the status code to 200.
Output of
uname -a
orver
Linux quarkus 6.12.9-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 9 16:05:40 UTC 2025 x86_64 GNU/Linux
Output of
java -version
java 23.0.1 2024-10-15
Quarkus version or git rev
3.17.7
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.9
Additional information
No response
The text was updated successfully, but these errors were encountered: