I have a fairly rich domain model that is marshalled to XML and JSON as part of a REST API. In keeping with HATEOAS I would like to return link objects for many of these entities to provide URL/link relations for clients to use.
To do this, I could add a new property to (all of) my domain classes named "links" of type "List<RestLink>". This has the benefit that it would get picked up by the existing marshallers for XML and JSON. But I'd prefer to not pollute my domain model with web service concerns if possible. That said, I *really* do not want to create 100+ JAX-B XML adapters either. Any ideas on a good way to approach this? Is there such a thing as a universal JAX-B adapter? Are their marshalling events that I could hook into to do this? Just trying to think of an elegant AOP-like approach. -- View this message in context: http://cxf.547215.n5.nabble.com/Good-way-to-add-link-relations-to-REST-responses-tp5461580p5461580.html Sent from the cxf-user mailing list archive at Nabble.com.
