Sergey -- Just wanted to close the loop on this. Because I will want to perform schema validation (in the future) on my response payloads, it was necessary to add a collection of hyperlinks as a Java/JAX-B type to every class in my domain model. I could see no way around it. However, I judged this minor leakage of concerns to be far better than creating 100+ JAX-B adapters.
Once I did this, all that was left was to insert the hyperlinks into the domain objects response representation(s) from within my resource classes. Knowing that I must, for performance reasons, send nested object graphs to the client, I needed to traverse the response object graph to insert hyperlinks. For this I used the visitor pattern. In this way, I concentrated all the logic about hypermedia into a single HypermediaVisitor class. All I have to do is invoke the visitor on the root object in the response graph before return the value from my resource service method. I thought about creating an annotation for this that would take the name of the hypermedia visitor, but I don't know exactly how to do this and am running short on time. I also thought about invoking the visitor using AOP, but I am wary of having too much magic. In any event, it works well and seems reasonably loosely coupled. I am hoping the brain-trust behind REST 2.0 will do a good job and get something out soon. Best, Dave -- View this message in context: http://cxf.547215.n5.nabble.com/Good-way-to-add-link-relations-to-REST-responses-tp5461580p5470228.html Sent from the cxf-user mailing list archive at Nabble.com.
