users@jersey.java.net

[Jersey] media type mappings not working

From: Dário Abdulrehman <dario.rehman_at_gmail.com>
Date: Tue, 26 Jan 2010 13:20:01 +0000

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);

    }
}