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

Resteasy-reactive Partial Content support (Range: bytes http header) #37205

Closed
Maldivia opened this issue Nov 19, 2023 · 4 comments · Fixed by #37213
Closed

Resteasy-reactive Partial Content support (Range: bytes http header) #37205

Maldivia opened this issue Nov 19, 2023 · 4 comments · Fixed by #37213
Labels
area/rest kind/enhancement New feature or request
Milestone

Comments

@Maldivia
Copy link
Contributor

Describe the bug

File download continuation does not work with quarkus-resteasy-reactive as it works with quarkus-resteasy.

Expected behavior

That quarkus-resteasy-reactive would work the same as quarkus-resteasy, returning a "206 Partial Content", with the appropriate headers for continuing the download.

Actual behavior

quarkus-resteasy-reactive returns a 200.

How to Reproduce?

Given the following test class:

package org.acme.test;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.Response;

import java.io.File;

@Path("/file")
public class FileResource {
  static final String PATH = "/some/path/to/large-file";

  @GET
  public Response getFile() {
    return Response.ok(new File(PATH)).build();
  }
}

Running: curl -v -O -C - http://localhost:8080/file

With quarkus-resteasy:

* Connected to localhost (127.0.0.1) port 8080
> GET /file HTTP/1.1
> Host: localhost:8080
> Range: bytes=187170812-
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 206 Partial Content
< Content-Length: 7872772309
< Content-Range: bytes 187170812-8059943120/8059943121
< Content-Type: application/octet-stream
<

But with quarkus-resteasy-reactive

* Connected to localhost (127.0.0.1) port 8080
> GET /file HTTP/1.1
> Host: localhost:8080
> Range: bytes=187170812-
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< content-length: 8059943121
<
* HTTP server doesn't seem to support byte ranges. Cannot resume.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.5.2

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

No response

Additional information

No response

@Maldivia Maldivia added the kind/bug Something isn't working label Nov 19, 2023
Copy link

quarkus-bot bot commented Nov 19, 2023

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

@geoand geoand added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Nov 20, 2023
@geoand
Copy link
Contributor

geoand commented Nov 20, 2023

Interesting we didn't have a need for this so far!

It should be pretty easy to fix this really, I'll have a look

geoand added a commit to geoand/quarkus that referenced this issue Nov 20, 2023
@Maldivia
Copy link
Contributor Author

Related, but don't really know if this is a bug report here or somewhere else, but noticed when I was looking at the above PR.

In the docs (https://quarkus.io/guides/resteasy-reactive#returning-a-response-body) java.nio.file.Path is listed as an accepted type as well, but based on the source code, Path.toFile() is called, meaning this will only work if the Path points to a physical file on disk, meaning cannot work with other FileSystems, such as Zip FS. I guess a clarification in the docs would help here?

@geoand
Copy link
Contributor

geoand commented Nov 20, 2023

I guess a clarification in the docs would help here?

Feel free to open a PR with this clarification

geoand added a commit that referenced this issue Nov 21, 2023
Add basic Range header support
@quarkus-bot quarkus-bot bot added this to the 3.7 - main milestone Nov 21, 2023
@gsmet gsmet modified the milestones: 3.7 - main, 3.6.0 Nov 21, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 21, 2023
Closes: quarkusio#37205
(cherry picked from commit b84fcde)
computerlove pushed a commit to computerlove/quarkus that referenced this issue Nov 27, 2023
DavideD pushed a commit to DavideD/quarkus that referenced this issue Nov 27, 2023
geoand added a commit that referenced this issue Dec 1, 2023
Add Content-Range header to 206 Partial Content file response
benkard pushed a commit to benkard/mulkcms2 that referenced this issue Dec 2, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [flow-bin](https://github.com/flowtype/flow-bin) ([changelog](https://github.com/facebook/flow/blob/master/Changelog.md)) | devDependencies | minor | [`^0.222.0` -> `^0.223.0`](https://renovatebot.com/diffs/npm/flow-bin/0.222.0/0.223.2) |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | minor | `3.5.3` -> `3.6.0` |
| [io.quarkus:quarkus-universe-bom](https://github.com/quarkusio/quarkus-platform) | import | minor | `3.5.3` -> `3.6.0` |

---

### Release Notes

<details>
<summary>flowtype/flow-bin</summary>

### [`v0.223.2`](flow/flow-bin@5bb7bcf...6e1e3f7)

[Compare Source](flow/flow-bin@5bb7bcf...6e1e3f7)

### [`v0.223.0`](flow/flow-bin@84a68f1...5bb7bcf)

[Compare Source](flow/flow-bin@84a68f1...5bb7bcf)

</details>

<details>
<summary>quarkusio/quarkus</summary>

### [`v3.6.0`](https://github.com/quarkusio/quarkus/releases/tag/3.6.0)

[Compare Source](quarkusio/quarkus@3.5.3...3.6.0)

##### Major changes

-   [#&#8203;37241](quarkusio/quarkus#37241) - Make improvements to REST Client SSE handling

##### Complete changelog

-   [#&#8203;37242](quarkusio/quarkus#37242) - Support Docker Desktop for building native executables
-   [#&#8203;37241](quarkusio/quarkus#37241) - Make improvements to REST Client SSE handling
-   [#&#8203;37240](quarkusio/quarkus#37240) - Updates Infinispan to 14.0.21.Final
-   [#&#8203;37238](quarkusio/quarkus#37238) - Build cache - Only store if the access key is around
-   [#&#8203;37236](quarkusio/quarkus#37236) - Api to read minimum and recommended Java versions from catalog metadata
-   [#&#8203;37221](quarkusio/quarkus#37221) - Image updates (including Java 21 base image)
-   [#&#8203;37218](quarkusio/quarkus#37218) - Fix OpenTelemetry trace exclusion of endpoints served from the management interface
-   [#&#8203;37213](quarkusio/quarkus#37213) - Add basic Range header support
-   [#&#8203;37205](quarkusio/quarkus#37205) - Resteasy-reactive Partial Content support (Range: bytes http header)
-   [#&#8203;37204](quarkusio/quarkus#37204) - Allow to define allowed roles as configuration expressions inside `@SecureField` annotation
-   [#&#8203;37201](quarkusio/quarkus#37201) - Fixed sample code for KotlinModule initialization
-   [#&#8203;37198](quarkusio/quarkus#37198) - Some minor refinements for build scans
-   [#&#8203;37193](quarkusio/quarkus#37193) - AccessDeniedException error with build using native image on linux with Docker Desktop
-   [#&#8203;37185](quarkusio/quarkus#37185) - Removed DependencyFlags.REMOVED
-   [#&#8203;37170](quarkusio/quarkus#37170) - Fix snapshots following a collision of pull requests
-   [#&#8203;37166](quarkusio/quarkus#37166) - Support custom Authorization schemes for OIDC bearer tokens
-   [#&#8203;37162](quarkusio/quarkus#37162) - Bump org.apache.commons:commons-text from 1.10.0 to 1.11.0
-   [#&#8203;37161](quarkusio/quarkus#37161) - Bump io.quarkus:quarkus-platform-bom-maven-plugin from 0.0.97 to 0.0.99
-   [#&#8203;37158](quarkusio/quarkus#37158) - Bump com.unboundid:unboundid-ldapsdk from 6.0.9 to 6.0.10
-   [#&#8203;37153](quarkusio/quarkus#37153) - Bump smallrye-jwt version to 4.4.0
-   [#&#8203;37149](quarkusio/quarkus#37149) - Bump com.squareup.okio:okio from 1.17.2 to 1.17.6 in /bom/application
-   [#&#8203;37107](quarkusio/quarkus#37107) - Rest client able to get full SSE event
-   [#&#8203;37101](quarkusio/quarkus#37101) - Remove `smallrye-opentracing` from native tests modules in CI
-   [#&#8203;37094](quarkusio/quarkus#37094) - Bump jakarta.json:jakarta.json-api from 2.1.2 to 2.1.3
-   [#&#8203;37092](quarkusio/quarkus#37092) - Bump mongo-client.version from 4.11.0 to 4.11.1
-   [#&#8203;37067](quarkusio/quarkus#37067) - SmallRye GraphQL 2.6 + custom scalar registration
-   [#&#8203;37053](quarkusio/quarkus#37053) - Clarify dynamic Environment Variables name conversion
-   [#&#8203;37004](quarkusio/quarkus#37004) - Move failsafe config to the root instead of in an execution
-   [#&#8203;36976](quarkusio/quarkus#36976) - Error in JBossLoggerFinder during integration test
-   [#&#8203;36804](quarkusio/quarkus#36804) - `@SecureField` add expression support
-   [#&#8203;36801](quarkusio/quarkus#36801) - Add note that endpointdisabled does not work native
-   [#&#8203;36746](quarkusio/quarkus#36746) - Allow using a random test port within Google Cloud Function tests
-   [#&#8203;35476](quarkusio/quarkus#35476) - Random test port does not work together with google-cloud-functions extensions

</details>

<details>
<summary>quarkusio/quarkus-platform</summary>

### [`v3.6.0`](quarkusio/quarkus-platform@3.5.3...3.6.0)

[Compare Source](quarkusio/quarkus-platform@3.5.3...3.6.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants