1

Would like to accept all requests independent on the Content-Type set in header.

As an example a Content-Type can be application/json. By then setting:

@Consumes(MediaType.WILDCARD)

Will respond: HTTP 415 Unsupported Media Type

But if the consume is defined as a list with multiple items:

@Consumes({ MediaType.WILDCARD, MediaType.APPLICATION_SVG_XML })

The request is accepted: 200 OK

Any ideas why not the MediaType.WILDCARD accepts application/json?

Edit: Running javax.ws.rs-api-2.1.jar

Grains
  • 950
  • 3
  • 16
  • 35
  • Sounds like a bug. What implementation are you using? And BTW, you can just remove the annotation altogether – ernest_k Feb 13 '19 at 10:13
  • @ernest_k said it all, but btw: `@Consumes({ MediaType.WILDCARD })` one could try too. – Joop Eggen Feb 13 '19 at 10:18
  • @ernest_k Running javax.ws.rs-api-2.1.jar. By removing the `@Consume` I get the same problem where it only accepts requests when `Content-Type` is not defined. @Joop Eggen Same problem there. – Grains Feb 13 '19 at 10:34

0 Answers0