users@jersey.java.net

Re: [Jersey] Unmarshaling JAXB object from JSON

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Tue, 31 Mar 2009 14:24:58 -0400

Farrukh Najmi wrote:
> Farrukh Najmi wrote:
>> Marc Hadley wrote:
>>> I think if you inject an instance of Providers then you should be
>>> able to use the getMessageBodyReader method to get a reader that
>>> will unmarshall your JSON string.
>>>
>>
>> Thanks Marc. Can you tell me how to "inject an instance of
>> Providers". I have a JAXBContextResolver class that implements
>> ContextResolver<JAXBContext>. I do not know though how I can get an
>> instance of that class injected in my class.
>>
> OK. I RTFMed of the jsr 311 spec.
>
> I can get Providers injected via @Context annotation within my class.
> Thanks.
>
Hi Marc,

I am unclear from javadoc of getMessageBodyWriter what I should use for
type and genericType params.
I need to unmarshal the JSON String into List<PostalAddressType>.

Also, I am not sure if I need to supply annotations param.

Thanks for any tips.

-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com