If the Accept
header param string has multiple media types that are acceptable such as:
text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
How to find if the media type is compatible with a single MediaType object?
If the Accept
header contains a single media type then it works.
MediaType.valueOf(acceptHeaderparam).isCompatible(MediaType.valueOf(contentType)
Is there some method such as MediaType.isCompatible(String)
?
NOTE: @Consumes
header can not be used because the custom media types are supported and the all the media types can not be determined at the compile time.
Something like this?