users@jersey.java.net

Re: [Jersey] Native JSON binding using JacksonJsonProvider

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 12 Mar 2009 09:06:21 +0100

On Mar 12, 2009, at 12:09 AM, Tatu Saloranta wrote:

> On Wed, Mar 11, 2009 at 7:29 AM, Jakub Podlesak <Jakub.Podlesak_at_sun.com
> > wrote:
> ...
>>>> Would you mind adding this provider to the jersey code base
>>>> after some testing?
>>>
>>> Not at all, I can do that. It does need testing, so maybe other
>>> users
>>
>> Great! It should go to the jersey-json module [1].
>
> Makes sense.
>
>> And since the module currently depends on jackson 0.9.4, you will
>> need to tweak the pom,
>> and possibly also some already existing code as well as i saw some
>> minor
>> things changed in jackson in the meantime.
>
> Yes.
>
>> Then you should also register the provider
>> via adding it to the end of
>> META-INF/services/javax.ws.rs.ext.MessageBody(Reader|Writer)
>> lists instead of using the @Provider annotation.
>
> Yes, I suspected there must be a simpler way to register the provider.
> I assume that might actually work from within other jars, even outside
> of Jersey?
>

It does (see the META-INF/servces of the jersey-core jar), although it
is not something that i recommend developers utilize.

James had a good idea of providing one META-INF/services configuration
file listing root resource and/or provider classes. Which i think is a
better idea than separate META-INF/service files for each "service".

And in the case of the Jackson integration we need (at least at first)
a way to control the order, because it can work on any object.

Paul.