On Mar 18, 2010, at 8:43 PM, Markus Karg wrote:
> I have the need that my JAX-RS resource shall produce application/
> foobar+xml when a client actually request test/xml. How can I do
> that? When I just specify @Produces("application/foobar+xml") then a
> request for test/xml is rejected with 406. :-(
>
> Any ideas (besides manually setting the response header)?
>
Other than manually doing:
@Produces("application/foobar+xml, text/xml")
public Response x(...) {
return Response.ok(..., "application/foobar+xml").build();
}
you would need to write a resource-specific filter and use an
annotation to declare media type mappings, such that the filter would
modify the accept header accordingly.
Paul.