-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application/octet-stream is set as mediaType when uploading json file payload using form parameters instead of application/json #4834
Comments
This was referenced Nov 4, 2022
Merged
This was referenced Nov 20, 2022
1 task
1 task
This was referenced Dec 17, 2022
1 task
This was referenced Jul 24, 2023
This was referenced Aug 14, 2023
1 task
This was referenced Sep 11, 2023
1 task
This was referenced Nov 25, 2023
1 task
This was referenced Jan 3, 2024
1 task
1 task
1 task
Open
1 task
1 task
1 task
This was referenced Jul 9, 2024
1 task
1 task
1 task
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
jersey/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/file/DefaultMediaTypePredictor.java
Line 136 in 21b7cc0
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.
The text was updated successfully, but these errors were encountered: