users@jersey.java.net

Re: [Jersey] media type mappings not working

From: Santiago Pericas-Geertsen <Santiago.Pericasgeertsen_at_Sun.COM>
Date: Tue, 26 Jan 2010 09:26:47 -0500

Dario,

 Could you provide more information about how your resource classes look like?

-- Santiago

On Jan 26, 2010, at 8:20 AM, Dário Abdulrehman wrote:

> I added the following media type mappings but I get a resource not available error if I invoke my WS with, for example, GET /resource.json
>
> I am using Glassvish v3 and Jersey 1.1.
>
> Thanks.
>
> public class MyServletContainer extends ServletContainer {
> @Override
>
> public void initiate(ResourceConfig rc, WebApplication wa ) {
>
> super.initiate(rc, wa);
>
> rc.getMediaTypeMappings().put("json", MediaType.APPLICATION_JSON_TYPE);
> rc.getMediaTypeMappings().put("rdf", MediaTypeExt.APPLICATION_RDF_XML_TYPE);
>
> }
> }
>