users@jersey.java.net

Best Way to implement resource uri

From: Leif Gensert <leif_at_gensert.de>
Date: Thu, 3 Apr 2008 17:05:37 +0200

hi,


I'm writing an REST-Web-Service which returns Plain Old XML. I'd like
to add a resource URI to all my resource. It should look like this:

http://www.xfront.com/REST-Web-Services.html

<?xml version="1.0"?>
<p:Parts xmlns:p="http://www.parts-depot.com"
         xmlns:xlink="http://www.w3.org/1999/xlink">
      <Part id="00345" xlink:href="http://www.parts-depot.com/parts/00345"/>
      <Part id="00346" xlink:href="http://www.parts-depot.com/parts/00346"/>
      <Part id="00347" xlink:href="http://www.parts-depot.com/parts/00347"/>
      <Part id="00348" xlink:href="http://www.parts-depot.com/parts/00348"/>
</p:Parts>

What I'm currently doing is, add the base-url to every resource object
manually as an attribute and let jaxb do the rest.

Isn't there a nicer way in JSR-311 oder jersey to achieve this feature?

Leif