users@jersey.java.net

[Jersey] Re: Deserializing nested objects

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Fri, 25 Nov 2011 10:15:37 -0800

2011/11/25 António Mota <amsmota_at_gmail.com>:
> Hi, thanks for your response.
> I tried to test with another method returning a single instance of my Image
> class instead of a List<Image> and the problem still happens, meaning it's

Ok, I am guessing you problem is here:

...
> @XmlRootElement(name="imageAnnotation")
> @XmlAccessorType(XmlAccessType.NONE)
> public class ImageAnnotation {
>     @XmlElement
>     private long id;
>     @XmlElement
>     private int imageId;
>     @XmlElement
>     private String reference;
>     @XmlElement
>     private String comments = null;
>     @XmlElement
>     private int page;
>     @XmlJavaTypeAdapter(AnyTypeAdapter.class)
>     private BoxCoordinates coordinates;

Two guesses:

* Depending on exactly how 'getCoordinates()' is defined, maybe type
it gives is different from BoxCoordinates -- if it returned Object,
we'd get this error (but I guess this is not the case)
* Not sure if you'd need to add @XmlElement next to
@XmlJavaTypeAdapter, to make this field visible. You can try it to see
if anything changes.

Also: are you using 1.9.x or earlier version? (apologies if I missed
this part). 1.9 should work better wrt property introspection than
earlier versions.

-+ Tatu +-