users@jersey.java.net

[Jersey] Re: Cyclic Graphs / Custom de-serialisation

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Sun, 9 Oct 2011 20:32:15 -0700

On Sun, Oct 9, 2011 at 12:01 PM, David Marsh <dmarsh26_at_hotmail.com> wrote:
> Hello,
> I have my domain model which has various relations and bi-directional
> associations,  parent - child etc.
> In order to allow for Jersey Marshalling I have had to use @XmlID and
> @XmlIDREF annotations.
> This effectively short cuts the graph and only serializes a section.
> Now certain entities do not de-serialise correctly because they have been
> pruned from the XML.
> I would like to find some way to fix this.
> Since there appears to be no true graph support in Jersey I need a
> workaround.
> I was thinking that maybe there is some sort of de-serialisation context
> where I can intercept the XML/JAXB and turn ID's back into objects in the
> Jersey client.
> Is this possible ? Any thoughts on how to go about it ?

You could consider using XStream instead, and write custom
reader/writer to use it instead of JAXB; XStream can handle cyclic
graphs just fine.

-+ Tatu +-