users@jersey.java.net

RE: [Jersey] ImplicitProduces annotation

From: Camel Christophe <ccamel_at_cls.fr>
Date: Mon, 28 Jun 2010 15:39:11 +0200

Great it works very fine !

Thanks a lot.

-----Message d'origine-----
De : Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Envoyé : lundi 28 juin 2010 14:45
À : users_at_jersey.dev.java.net
Objet : Re: [Jersey] ImplicitProduces annotation

Hi,

@ImplicitProduces is only utilized for defining the media type of
implicit views (e.g. when assigning JSPs as the view templates when no
@GET methods are defined that match the media types in the
@ImplicitProduces). In this case since your response is explicit you
can set the "qs" value on the @Produces of your resource method:

    @GET
    @Produces( { "application/xhtml+xml;qs=3, "text/html;qs=2",
MediaType.APPLICATION_XML })
    public synchronized Response getFoo() {
        return ...
    }


or:

    @GET
    @Produces("application/xhtml+xml;qs=3, text/html;qs=2, application/
xml")
    public synchronized Response getFoo() {
        return ...
    }

and from the above you can use your own string constant.

Paul.