I'm developing a web API in which I want to add support of all the media types, because of functionality requirements. I've tried to give @consumes("*/(")
at class level and method level as well. But it didn't worked for me when I tried to access my api with application/json
media type in Content-Type
header.
I've looked at the implementation of @consumes annotation in which its default value is */*
so I tried to use this annotation as @consumes
only so it can add default value, but that didn't worked as well.
For the time being i've used this annotation as
@Consumes({"application/*","text/*"})
which allows the client to access my API with all possible media types from either of these media type groups. But still if client sends request with multipart/signed
or any other media type it messes up.
*/*
, and only use those that you know you have configured support for.*/*
to work for me. But it isn't working. If I dont use @consumes annotation at all, then again it gives me exception.*/*
, doesn't mean your application can support it. You need provider to handle each individual type you advertise support for in the @Consumes annotation