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

REST Reactive Server: support multiple outparts with the same key in MultipartFormDataOutput #42053

Closed
comrt opened this issue Jul 22, 2024 · 2 comments · Fixed by #42057
Closed
Labels
area/rest kind/enhancement New feature or request
Milestone

Comments

@comrt
Copy link

comrt commented Jul 22, 2024

Description

Unfortunately the Quarkus REST (Reactive) server side implementation of MultipartFormDataOutput does not support multiple form data with the same key. This is very inconvenient if you're coming from resteasy classic, where this is supported.

e.g. this formData will return only the last added part, because internally it is kept in a linkedhashmap.

import org.jboss.resteasy.reactive.server.multipart.MultipartFormDataOutput;

...

MultipartFormDataOutput formData = new MultipartFormDataOutput();
try {
  formData.addFormData("files", new TempFileInputStream(invoice), MediaType.APPLICATION_OCTET_STREAM_TYPE, "invoice.pdf");
  formData.addFormData("files", new TempFileInputStream(agb), MediaType.APPLICATION_OCTET_STREAM_TYPE, "agb.pdf");
} catch (FileNotFoundException e) {
 throw new IllegalStateException(e.getMessage());
}
return formData;

Hope you can me help out here. I my use case MultipartFormDataOutput is very useful, because you can return binary data, which is loaded from a database and temporarily written to a tempfile for deletion, when response is sent.
Thanks and keep up the marvelous work!

Implementation ideas

No response

@comrt comrt added the kind/enhancement New feature or request label Jul 22, 2024
Copy link

quarkus-bot bot commented Jul 23, 2024

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

@geoand
Copy link
Contributor

geoand commented Jul 23, 2024

Seems reasonable to me, let me take a look

@geoand geoand closed this as completed in 392d68c Jul 23, 2024
geoand added a commit that referenced this issue Jul 23, 2024
Allow MultipartFormDataOutput to specify items with the same key
@quarkus-bot quarkus-bot bot added this to the 3.14 - main milestone Jul 23, 2024
@gsmet gsmet modified the milestones: 3.14 - main, 3.13.0 Jul 23, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 23, 2024
barreiro pushed a commit to barreiro/quarkus that referenced this issue Jul 25, 2024
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Jul 31, 2024
danielsoro pushed a commit to danielsoro/quarkus that referenced this issue Sep 20, 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