I am using jersey implementation for creating a REST service and trying to upload .json file to the server using form parameters. I am creating a FileDataBodyPart object and passing it to object of FormDataMultiPart.
FileDataBodyPart fileBodyPart = new FileDataBodyPart(name, file); form.bodyPart(fileBodyPart);
The default MediaType that is getting set here is application/octet-stream. I looked at jersey library code, it internally "decides" which mediatype to set. If the file type is not in the list of CommonMediaTypes then it sets it as octect-stream.
|
public static MediaType getMediaTypeFromFileName(final String fileName) { |
The above URL points to the jersey code which lists available mediatypes. application/json is not in the list of supported formats.
I wanted to know if there is a specific reason for not supporting the json format by jersey library? Or The support for application/json is added in more recent versions of jersey for multipart file upload.