users@jersey.java.net

[Jersey] Re: Is Jackson the default provider for consuming/producing JSON?

From: Naresh Bhatia <NBhatia_at_sapient.com>
Date: Tue, 11 Oct 2011 07:11:39 -0400

Thanks Jakub. This is very helpful.

Naresh


-----Original Message-----
From: Jakub Podlesak [mailto:jakub.podlesak_at_oracle.com]
Sent: Tuesday, October 11, 2011 3:49 AM
To: users_at_jersey.java.net
Subject: [Jersey] Re: Is Jackson the default provider for consuming/producing JSON?

Hi Naresh,

The default JSON provider in Jersey on GlassFish is an internal one, (relying on Jackson library internally, but working via the StAX API) which is capable of processing JAXB beans. To get it work, you only need to use @Produces/_at_Consumes annotations appropriately on methods dealing with JAXB beans.

The way you configure your JAX-RS application is unrelated to the above.

More info on JSON configuration in Jersey could be found in [1].
More info on Jersey deployment options are available in [2].

HTH,

~Jakub


[1]http://jersey.java.net/nonav/documentation/latest/json.html#json
[2]http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e196

On 10.10.2011 19:26, nbhatia_at_sapient.com wrote:
> I am using Jersey on GlassFish 3.1. I have a simple question about
> consuming/producing JSON in this environment - is Jackson the default
> provider for this? The reason I ask is that JSON
> serialization/deserialization started working for me as soon as I
> added
> @Consumes(MediaType.APPLICATION_JSON) and
> @Produces(MediaType.APPLICATION_JSON) annotations. I did not have to
> define a subclass of javax.ws.rs.core.Application and define it as a
> context parameter in web.xml (as suggested by some articles on the web
> such as this one:
> http://architects.dzone.com/articles/putting-java-rest). Is GlassFish
> doing all this by default?
>
> Thanks.
>
> Naresh
>