I'm currently struggling with the following snippet which used to work with
TomEE 8.x but fails on 9.1.2:
@POST
@Path("/documents/{type}/by-id/{id}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response postWithId(@PathParam("type") String type, @PathParam("id") int
id,
@Multipart(value = "file") Attachment
attachment,
@Multipart(value = "category")
DocumentCategory category,
@Multipart(value = "description",
required = false) String description) {
// ...
}
DocumentCategory is an Enum. A POST request with an example file and the
category set to "GENERIC" invokes the function with the category parameter set
to "null".
Doing things by hand works just fine, though:
@POST
@Path("/documents/{type}/by-id/{id}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response postWithId(@PathParam("type") String type, @PathParam("id") int
id,
@Multipart(value = "file") Attachment
attachment,
@Multipart(value = "category") String
category,
@Multipart(value = "description",
required = false) String description) {
DocumentCategory cat = DocumentCategory.valueOf(cat);
// ...
}
Am I missing something here?