users@jersey.java.net

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

From: Pengfei Di <pengfei.di_at_match2blue.com>
Date: Fri, 8 Apr 2011 12:57:54 +0200

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.

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
>
>