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

Returning Uni<AsyncFile> doesn't work as described #429

Closed
snowdrop-bot opened this issue Sep 24, 2021 · 0 comments
Closed

Returning Uni<AsyncFile> doesn't work as described #429

snowdrop-bot opened this issue Sep 24, 2021 · 0 comments
Assignees
Labels
7 - Community development upstream/closed The issue has been closed in the upstream repository

Comments

@snowdrop-bot
Copy link
Collaborator

Describe the bug

Hello,

In documentation, it is stated that returning an AsyncFile or Uni<AsyncFile> should lead to contents of the file being returned, however, when I try to return Uni<AsyncFile>, or particularly Uni<io.vertx.mutiny.core.file.AsyncFile> which is by default returned from vertx.fileSystem().open(), what I get is just a string representation of the AsyncFile class.

Expected behavior

The contents of the file should be returned by the server

Actual behavior

A reply with following content is returned io.vertx.core.file.impl.AsyncFileImpl@54d3c384

How to Reproduce?

The following code reproduces the problem for me:

@Path("/photo")
@ApplicationScoped
public class PhotoResource {
    private final Vertx vertx;

    @Inject
    public PhotoResource(Vertx vertx) {
        this.vertx = vertx;
    }

    @GET
    @Blocking
    @Produces("image/jpeg")
    public Uni<AsyncFile> getPhoto(@QueryParam("id") String id) {
        return vertx.eventBus().<JsonObject>request("photo", new JsonObject().put("id", id))
          .onItem().transformToUni(message -> vertx.fileSystem()
            .open(message.body().getString("path"), new OpenOptions().setRead(true)));  
    }
}

Output of uname -a or ver

Microsoft Windows [Version 10.0.19043.1237]

Output of java -version

openjdk version "11.0.10" 2021-01-19 LTS

GraalVM version (if different from Java)

OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 11.0.12+6-jvmci-21.2-b08)

Quarkus version or git rev

2.2.2.Final

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

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

No response


quarkusio#20352


$upstream:20352$

@snowdrop-bot snowdrop-bot added the upstream/closed The issue has been closed in the upstream repository label Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7 - Community development upstream/closed The issue has been closed in the upstream repository
Projects
None yet
Development

No branches or pull requests

2 participants