users@jersey.java.net

Connectedness, Jaxb and link paths

From: tarjei <tarjei_at_nu.no>
Date: Wed, 24 Sep 2008 13:10:37 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, an aspect of REST applications is the concept of connectedness. That
a resource should provide links to other resources that it is connected to.

Now, does anyone have a tip on how to do this and still keep jaxb happy?

I got two usecases:

1. A field with a link to a testservice for that url:

<url href="/myservice/test/http://test.com">http://test.com</url>

2. Representing a mapping (*:* or 1:*) in the representation without
showing the complete object:
<subscribers>
<subscriber href="/subscribers/jonas_at_sm.com" id="1" email="jonas_at_sm.com"/>
<subscriber href="/subscribers/jonas_at_sm.com" id="1" email="jonas_at_sm.com"/>
</subscribers>

I have already implemented an adapter to that works fairly well, however
 it is not general, so if anyone has some tips on how I can create a
general linkadapter that will work without me defining the link every
time, that would be great. I'm planning to build a rest interface
against a DB with 50+ tables soon and I'll be needing it then.

With regard to the first one, I want to keep the links inside the
resource somehow but with jax not knowing about them. Should I just use
some separate namespace for the links, like xlink?

Also, the last part of this question is, is there a general way to
generate absolute links?

For example, if the service is running bellow the url /services/ on a
host named myservice running on port 8080, I want the links to be to
http://myservice:8080/services/...


Kind regards,
Tarjei
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI2iAtYVRKCnSvzfIRAh5cAJ0bIw98Cb7jWrpubNEcROAG4liOvgCfUaIZ
CuSs8x7Zh04ctrkq5EaMdME=
=XNBW
-----END PGP SIGNATURE-----