I want to keep uploaded files only in memory, so I tried to create a service that accepts multipartformdata as byte[]. However, every upload creates a temporary file and I cannot let this run stateless / read-only.
I use it like this
public class FormData {
@FormParam("myFile")
@PartType(MediaType.APPLICATION_OCTET_STREAM)
public byte[] binaryPart;
}
I was able to solve this with Quarkus Version 3+ by using a JAXB-Class like this:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class MultipartBody {
@RestForm("name")
@XmlMimeType((MediaType.TEXT_PLAIN))
String name;
@RestForm("file")
@XmlMimeType(MediaType.APPLICATION_OCTET_STREAM)
byte[] bytes;
}
I think this was simply a bug in the resteasy-reactive implementation that has been fixed in later Quarkus versions. In Quarkus 2 I had to rely on resteasy-classic.