Suppose I have two endpoints that look like this:
@GET
@Path("/blah")
@Produces(MIME_TYPE_1)
public Thing getThing() {
....
}
@GET
@Path("/blah")
@Produces(MIME_TYPE_2)
public OtherThing getOtherThing() {
....
}
This works very well for arbitrating which method gets invoked based on the Accept
header that the client sends.
The problem I'm having is that if the client misses off the Accept
header entirely, I (for some reason) get the second method invoked, and I want it to be the first one.
There's an additional complication, which is that this is feeding automatically into Swagger documentation, and I don't want extra MIME types to appear in the documentation, so I don't want (for instance) to add */*
to the types accepted by the first method.
(This is using Dropwizard and Jersey 1.x, though I am still interested to hear solutions based on Jersey 2.x, to which we may upgrade before long.)