The JAX-RS specification doesn't say anything about how multipart/form-data should be handled. Different JAX-RS implementations have their own proprietary ways to deal with this. As far as I can find, Apache Wink (that we build on top of) doesn't support @FormParam for multipart. It does seems that there are some support types in Wink for multi part: http://wink.apache.org/documentation/1.1.1/html/7.8%20MultiPart.html but these classes are not exposed by the Amdatu Wink bundle, and I have never tried using this either.
A workaround I use myself is the example below. This is useful when multipart is used to upload files together with other form fields (this is why multipart is mostly used). I use Apache File Upload to parse the request and get access to both the uploaded files and form fields.
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void test(@Context HttpServletRequest request) {
ServletFileUpload uploader = new ServletFileUpload(new DiskFileItemFactory());
try {
List<FileItem> parseRequest = uploader.parseRequest(request);
for (FileItem fileItem : parseRequest) {
if (fileItem.isFormField()) {
System.out.println(fileItem.getFieldName() + ": "
+ fileItem.getString());
}
}
} catch (FileUploadException e) {
e.printStackTrace();
}
}