users@jersey.java.net

[Jersey] Re: Media Type and Accept

From: Michael Pratt <prattm_at_gmail.com>
Date: Wed, 24 Sep 2014 09:37:30 -0600

Have you tried tracing?

https://jersey.java.net/documentation/latest/user-guide.html#tracing

The MBW events should shed some light on the MessageBodyWriter selection.

Mike

On Wed, Sep 24, 2014 at 9:31 AM, Kevin Hale Boyes <kcboyes_at_gmail.com> wrote:

> I have an endpoint method that produces two output formats - XML and JSON.
> i.e.,
> @GET
> @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
> public MyModel getit() { ... }
>
> When the request comes in Jersey decides what output to generate based on
> the Accept request header. It processes the (possibly) complex list of
> acceptable types with the quality factors.
>
> Is there any way to get access to the decision it's made as to which
> output format it will generate?
>
> Thanks,
> Kevin.
>