1

I'm currently using Jersey 1.18 (for legacy reasons).

I have an api endpoint:

@GET
@Path("/something")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public final Response doMyThing(final @Context HttpServletRequest req, ...) {
...
}

But it's currently responding to calls where Accepts is set to text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3

I want Jersey to ignore it unless Accept is application/json.

How do I do that?

ndtreviv
  • 3,473
  • 1
  • 31
  • 45

0 Answers0