Skip to content

Media type matching is potentially too restrictive #106

@tonicsoft

Description

@tonicsoft

Suppose an HTTP client submits a request to the server with header "Accept: /" or even no accept header at all. Clearly, a json response is acceptable here. In both cases jersey will set the MediaType of the request to "/" (in the absense of any @produces annotation on the resource method).

The code eventually comes to jackson-jaxrs-json-provider-2.9.6-sources.jar:com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider:hasMatchingMediaType which returns false for MediaType.WILDCARD_TYPE.

I think that in this case it should return true. And by extension it should return true for application/* media types.

In other words, mediaType = MediaType.WILDCARD_TYPE should be handled in the same way as mediaType = null.

protected boolean hasMatchingMediaType(MediaType mediaType)

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-test-caseTo work on issue, a reproduction (ideally unit test) needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions