jaxb and xlink - friends or foes?
i want to build a rest service via cxf. this is already done with only two objects "Earthp开发者_如何学运维art" and "Earthquake". when i call localhost/earthpars i get a xml list of the earthparts with the earthquakes. but the earthquakeobject with more information {how heavy, how long, etc.} is only available with a xlink to localhost/earthquake/{id} shortly: In localhost/earthpars is only the xlink to localhost/earthquake/{id}.
now the technical part: to be honest the request was to use camel-cxf and jaxb to build a REST service. building xlinks with jaxb is possible with namespaces but thats obviously not the way to go! so the question is: is there any info about xlink in connection with jaxb anywhere or is that not the way to go for xlinks?
You could use an XmlAdapter to convert the child object to an xlink representation. For more information on XmlAdapter see:
- http://bdoughan.blogspot.com/2010/07/xmladapter-jaxbs-secret-weapon.html
精彩评论