users@jersey.java.net

[Jersey] Custom IDResolver

From: sarat.pediredla <sarat.pediredla_at_gmail.com>
Date: Thu, 30 Oct 2008 16:24:18 -0700 (PDT)

I have a very simple problem using Jersey but I cannot for the life of me
figure out how to do this in a pluggable manner without defining our own
custom @Provider for Unmarshalling.

Basically I have a class with a XmlIDRef to the XmlID of an associated
class. However, since the XML is using a Ref and not the entire XML map,
when someone does a PUT, the relationship gets destroyed.

Sample XML produced

<note>
<id>2</id>
<subject>asdf asdfa sdfa sdf</subject>
<created-at>2008-10-30T22:26:42.185Z</created-at>
<created-by>1</created-by> <---------- This is a XmlIDRef to a User
object
</note>

Now when I do a PUT, the createdBy is not automatically mapped to the
external User object (obviously).

Is there an easy way to define a custom IDResolver in Jersey without having
to write by own MessageBodyReader?

-- 
View this message in context: http://n2.nabble.com/Custom-IDResolver-tp1400907p1400907.html
Sent from the Jersey mailing list archive at Nabble.com.