Problem solved. Thanks!
On Tue, Jan 26, 2010 at 4:20 PM, Santiago Pericas-Geertsen <
Santiago.Pericasgeertsen_at_sun.com> wrote:
> Dario,
>
> That looks good. The problem is that you're updating the ResourceConfig
> too late in initialize() (the app is already configure after you call
> super()). The recommended way to fix that would be by overriding the
> configure() method [1].
>
> Note also that as of release 1.1.5 there's a way to specify properties
> such as PROPERTY_MEDIA_TYPE_MAPPINGS in web.xml.
>
> -- Santiago
>
> [1]
> https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html#configure(com.sun.jersey.spi.container.servlet.WebConfig,%20com.sun.jersey.api.core.ResourceConfig,%20com.sun.jersey.spi.container.WebApplication)<https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html#configure%28com.sun.jersey.spi.container.servlet.WebConfig,%20com.sun.jersey.api.core.ResourceConfig,%20com.sun.jersey.spi.container.WebApplication%29>
>
> On Jan 26, 2010, at 9:44 AM, Dário Abdulrehman wrote:
>
> They look like this:
>
> @GET
> @Produces({MediaType.APPLICATION_JSON,
> MediaTypeExt.APPLICATION_RDF_XML})
> public Response doGet(@Context Request req,
> @QueryParam("a") List<String> a,
> @QueryParam("b") List<String> b,
> @QueryParam("c") List<String> c,
> @QueryParam("d") String d,
> @QueryParam("e") String e) throws URISyntaxException,
> IOException, Exception {
> ....
> }
>
> MediaTypeExt is just a class that extends MediaType so I can define the new
> media type for application/rdf+xml.
>
> Thanks.
>
> On Tue, Jan 26, 2010 at 2:26 PM, Santiago Pericas-Geertsen <
> Santiago.Pericasgeertsen_at_sun.com> wrote:
>
>> 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);
>> >
>> > }
>> > }
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>
>