eclipse-ee4j / eclipse-ee4j/jersey

[Feature] StreamDataBodyPart could predict MediaType

Open
#4,903 0 comments 0 reactions 0 assignees View on GitHub
multipart
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

`FileDataBodyPart` and [`StreamDataBodyPart`](https://github.com/eclipse-ee4j/jersey/blob/master/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/file/StreamDataBodyPart.java) are both `BodyPart`s.

`FileDataBodyPart` takes a File whereas `StreamDataBodyPart` takes an InputStream.

`StreamDataBodyPart` takes also a filename along with the InputStream.

They both also take a MediaType.
In case the user doesn't pass in a MediaType, FileDataBodyPart is able to predict it from the filename. See link below.

https://github.com/eclipse-ee4j/jersey/blob/master/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/file/FileDataBodyPart.java#L85

Whereas StreamDataBodyPart can't.

I'm opening this issue to suggest to copy the prediction code in StreamDataBodyPart as well.

If you agree on the change, I'll see if I can find some time to work on it myself.

Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.