I have a web form which contains a file upload option and a host of other input parameters. I'm looking for some way to handle this with a Jersey request handler where the method parameters would be the file input, and "all other parameters".
This question explains that I can't get the other parameters into a custom model object, because the browser sends them as separate multipart objects. The next thing I tried was retrieving the other parameters in a MultivaluedMap
:
@POST
@Produces("text/html; charset=\"UTF-8\"")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Page handlePost(@FormDataParam("icon") InputStream iconInputStream,
@FormDataParam("icon") FormDataContentDisposition iconContentDispositionHeader,
MultivaluedMap<String, String> formParams) {
...
}
Unfortunately this does not work either.
There are about 20 other parameters in the form (one of which is a multiselect-option), so I wouldn't want to handle them one-by-one as method parameters. Is there any way in which I could get all the other parameters in a single object from which they could be queried?