dev@jersey.java.net

Re: [Jersey] URI Best Practice?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 30 Dec 2009 10:57:55 +0100

Hi Adam,

Note that from the client perspective they should not really care too
much about the URIs and how to construct them as it is usually the
server that informs the client on how to do that with links embedded
in representations.

If you specify to clients how to construct URIs as part of a
documented contract then it increases coupling between the client and
server and thus makes it harder to evolve the server. If you
understand this and the tradeoffs but still want to do that then it is
OK :-)

The logical relationship between "Lodgement" key and PDF looks good.
IMHO i prefer something like "server" or "api" to "rest".

I was wondering if may be possible to use the same URI for both non-
authenticated and authenticated requests depending on if the client
uses https and sends a client certificate? that might be cleaner but
is likely to depend on features of the web/app server to enable this.
Otherwise if that is not possible using distinct URI path to
distinguish between authenticated and non-authenticated is is an
appropriate solution (and it might be appropriate to deploy two
servlets in this respect).

HTH,
Paul.

On Dec 29, 2009, at 5:40 PM, Adam Retter wrote:

> Hi there folks, I am very new to using Jersey and I just wanted to get
> some feedback on the URI's I am using and whether I am following best
> practice or if people have any suggestions for improvement?
>
> The main resource that we are interested in is called a "Lodgement".
> Lodgements are an XML document with an embedded PDF (base64).
> Lodgements are always referenced by a key. For our site some access
> has to be public and some has to be secure (client certificates). The
> following two URI's I am using as my roots for my REST services -
>
> Public - http://www.company.com/rest/
>
> Client Certificates - https://www.company.com/rest/secure/
>
>
> We have the need for two services currently -
>
> 1) A service for the public to retrieve the PDF aspect of a Lodgement,
> for which I have used the following URI scheme -
>
> http://www.company.com/rest/lodgement/{key}/pdf
>
>
> 2) A service for authenticated users to retrieve the entire Lodgement,
> for which I have used the following URI scheme -
>
> https://www.compay.com/rest/secure/lodgement/{key}
>
>
> Does my approach meet the known best practices of RESTful URI's or
> could it be improved in someway?
>
>
> Thanks Adam.
>
> --
> Adam Retter
>
> skype :adam.retter
> http://www.adamretter.org.uk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>