users@jersey.java.net

Re: [Jersey] List marshall

From: Ricardo Borillo <borillo_at_si.uji.es>
Date: Mon, 20 Sep 2010 12:17:13 +0200

Thanks Tatu, now I got it :)

Added this dependency to my pom.xml:

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-jaxrs</artifactId>
      <version>1.1.1</version>
    </dependency>

And added JacksonJsonProvider's package to the web.xml jersey init params:

  <servlet>
    <servlet-name>rest-api</servlet-name>
    <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
    <init-param>
      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>org.codehaus.jackson.jaxrs;....</param-value>
    </init-param>
   ...

Thanks to all :)

---
Salut,
====================================
Ricardo Borillo Domenech
http://xml-utils.com / http://twitter.com/borillo
On Sun, Sep 19, 2010 at 23:14, Ricardo Borillo <borillo_at_si.uji.es> wrote:
> Hi Tatu,
>
> I'm using Jersey 1.1.5.1 and I thought i was using jackson when i have
> included jersey-json in my pom.xml ...
>
> Please, can you provide an example of how to load the jackson provider
> (as you say, on the source or servlet config)?
>
> Thanks in advance.
>
> ---
> Regards,
> ====================================
> Ricardo Borillo Domenech
> http://xml-utils.com / http://twitter.com/borillo
>
>
>
> On Sun, Sep 19, 2010 at 19:02, Tatu Saloranta <tsaloranta_at_gmail.com> wrote:
>> On Sun, Sep 19, 2010 at 8:11 AM, Ricardo Borillo
>> <Ricardo.Borillo_at_si.uji.es> wrote:
>>> Hi Angel,
>>>
>>> Thanks for your response, but if it's possible i prefer not to user directly
>>> JSON classes and work with JAXB ...
>>
>> As usual, many of problems can be solved by using direct Jackson
>> serialization, which does not add extra wrapper around root value.
>> Latest versions of Jersey allow this to be done by jersey JSON
>> configuration; and with earlier (1.2 and prior maybe?) you just
>> explicitly include JacksonJaxRsProvider (one-line in code, or couple
>> in servlet configuration).
>> This way no configuration is needed, not even @XmlRootElement, in
>> classes, nor use of any library-specific types. Just regular POJOs,
>> maps, lists or arrays.
>>
>> -+ Tatu +-
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>