I want to build a URL at runtime when a resource is render to either XML or JSON. I can do this easily when the view is HTML and is rendering only parts of the resource, but when I render a resource that contains a links to another resource I want to dynamically generate the correct URL according the host (site) and resource specific URI part.
<components>
<component id = "1234" name = "component A" version = "1.0">
<link rel = "/component" uri="http://localhost:8080/component/1234" />
</component>
<components>
How do I make sure the 'uri' value is correct?