In JAX-RS is there any way to define response type using query parameters instead of Accept header (e.g. /api/foo?format=json
)?
There are three ways to do content negotiation in JAX-RS: based on URL, based on Accept header and based on request parameter. Please check out link Content Negotiation Based on Request Parameter. It contains sample code how to do content negotiation on request parameter. The link is for Apache Wink project, but the code should work in Jersey implementation.