users@jersey.java.net

[Jersey] Overriding mediaType extensions using Filters

From: ganges <katakam.g_at_gmail.com>
Date: Sun, 6 Mar 2016 19:05:19 -0700 (MST)

Hi,

We are actually mapping the media types with the uri suffix's.

 Map<String, MediaType> type = config.getMediaTypeMappings();
 type.put("json", MediaType.APPLICATION_JSON_TYPE);
 type.put("xml", MediaType.APPLICATION_XML_TYPE);

And i have a resource which @Produces "application/xml".

Now, my requirement to send the response in application/xml format for the
uri's ending with suffix myhost.com/key.json

Since i have mapped the suffix's with media types which is always producing
the JSON in this case.
Also, i have observed the Accepts is ignored in my request header.

I can't turn off the mediatype mapping as some of the resources need to
produce application/json for json uri suffixes.

Is there a way i can fix this?





--
View this message in context: http://jersey.576304.n2.nabble.com/Overriding-mediaType-extensions-using-Filters-tp7583633.html
Sent from the Jersey mailing list archive at Nabble.com.