users@jersey.java.net

Re: Problem with Jersey Client API and JSON attributes

From: <jussi_at_lyytinen.org>
Date: Thu, 18 Nov 2010 18:53:58 +0200

Hi Jakub,

Yes, that's exactly what I mean and I'm also using Jersey at the server side.

My JSON markup contained attributes because I use inheritance in my
object model and by default JAXB seems to use the xsi:type attribute
to represent it. This transcribed xsi:type attribute then caused the
Jersey client to crash when it was parsing the response. As a
workaround I'm now using the @XmlElements annotation to force JAXB to
use tag names to represent inheritance. With this tweak everything
works fine but this has the drawback that I'm now explicitly defining
the mapping between a tag name and the corresponding concrete class.

I assume that I'm also discussing with the author of Jersey's
JsonXmlStreamReader and JsonReaderXmlEvent classes? If this is the
case, then I would like to repeat my question about the correctness of
always returning null as the attribute type. I mean the StAX API
documentation does not mention such possibility and the XML specs say
that a parser should fallback to CDATA if it does not know better.

Cheers,
Jussi

> Hi Jussi,
>
> You probably mean XML attributes transcribed to JSON, as there are no
> attributes defined in JSON, correct?
>
> Are you generating the JSON using Jersey on the server side? If so, you
> need to configure
> the client accordingly to how the server side is configured. If you
> send me your server details,
> i can try to help you setup the client side.
>
> In any case, a simple reproducible test case would be the most helpful.
>
> Thanks,
>
> ~Jakub