Hi Norbert,
You should be able to take advantage of the request selectVariant method (see [1]),
that will help you figure out desired media type based on the actual request headers.
The request could be injected into your resource/filter/interceptor method, so that you can pass it to your
exception when you instantiate it.
HTH,
~Jakub
[1]
https://jersey.java.net/apidocs/latest/jersey/javax/ws/rs/core/Request.html#selectVariant(java.util.List)
On Aug 9, 2013, at 1:28 AM, Norbert Kiesel <nkiesel_at_MetricStream.com> wrote:
> Hi,
>
> I have a server app that supports both XML and JSON as media type, using MOXy for marshalling and unmarshalling.
>
> My problem is that I want to use the request media type in WebApplicationException (or rather my Exception derived from that), but I can't figure out how to get the request media type inside the constructor. The samples in the user doc simply use.type("text/plain")
>
>
> </nk>
>
> ---
>
>
> Norbert Kiesel
> Systems Architect | Engineering
> MetricStream
> 2600 E. Bayshore Road | Palo Alto, CA - 94303
> +1-650-620-2954 | nkiesel_at_metricstream.com | www.metricstream.com
> Confidentiality Notice:This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited