[Jersey] Re: ContextResolver is called by AbstractRootElementProvider but not JacksonJsonProvider

From: Jakub Podlesak <>
Date: Fri, 08 Apr 2011 13:47:31 +0200

On 04/08/2011 12:57 PM, Pengfei Di wrote:
> Hello,
> just found the reason:
> I have to turn of the POJOMapping feature, otherwise the
> JacksonJsonProvider will have the precedence (instead of the
> AbstractRootElementProvider) for JSON representation.

Right. In fact, the POJO mapping feature is switched off by default
to maintain the backward compatibility with the previous Jersey releases.


> Pengfei
> On 04/08/2011 11:33 AM, Pengfei Di wrote:
>> Hello,
>> I have tried to make the JSONConfiguration working for a long time, but
>> still not succeed.
>> I added a JAXBContextResolver (from Example 5.6) into my test project,
>> and found something intresting in the method ContainerResponse.write():
>> If the response type is specified as "xml", an
>> AbstractRootElementProvider will be used to perform the writeTo()
>> method, and the JAXBContextResolver will be further used. (However, this
>> is useless for me, since I need JSON representation.)
>> if the response type is specified as "json", a JacksonJsonProvider will
>> be used, and it will never call JAXBContextResolver!!
>> Is it correct that JacksonJsonProvider is called here? If it is correct,
>> how can specify my JSONConfiguration to it?
>> Thanks a lot in advance?
>> Pengfei