I want to have something like
@POST
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Path("/")
void create(@Suspended final AsyncResponse asyncResponse,
@ApiParam(required = true) @NotNull @Valid final CreateServiceRequest service);
so I can consume both JSON and URL encoded. But when I make a POST request with -d foo=bar
I get 415 unsupported formatted error.
Is it possible to consume both using the same endpoint? If it is not possible, how do I do automatic validation for the body for URL encoded? I see people use MultivaluedMap
but that's just a map. I want to make sure the right fields are provided.