users@jersey.java.net

Re: [Jersey] howto RESTfully relate resources?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 08 Feb 2010 11:36:23 +0100

Hi,

Do you want to pass a URI as the value of a query parameter?

For example:

   http://foo/blah&uri=http://bar/ugh

You can do:

   @GET
   public XXX get(@QueryParam("uri") URI uri) { ... }

because URI contains a constructor that has a single string parameter.

Note that you need to make sure the client constructors the URI with
the embedded URI correctly such that the embedded URI is correctly
encoded, for example if the embedded URI has query parameters the
approach characters need to be percent encoded.

Paul.



On Feb 5, 2010, at 9:00 PM, FSauer_at_dsthealthsolutions.com wrote:

>
> Imagine a scenario where on a page a user needs to relate various
> resources together - in its simplest form a copy/paste scenario.
> The resource being pasted is identified with a URI. Now a request is
> made to the service containing that URI of the resource being
> related to the receving resource.... How do I translate that URI to
> the actual to be related resource?
>
> The jersey container already knows how to do this when it receives a
> request on that resource....
> Do I get access to that part of the container code so I can
> determine the resource identified by a URI received as data ,
> for example as a @QueryParam?
>
> Thanks,
> <mime-attachment.gif> Frank Sauer
> Principal Architect
> DST Health Solutions
> 2500 Corporate Drive
> Birmingham, AL 35242
> (205)437-5204 (Office) (Direct)
> (205)568-4684 (Cell)
> fsauer_at_dsthealthsolutions.com
> It is impossible to sharpen a pencil with a blunt axe. It is equally
> vain to try to do it with ten blunt axes instead -- Edsger W. Dijkstra
>
> ----------------------------------------- Please consider the
> environment before printing this email and any attachments. This e-
> mail and any attachments are intended only for the individual or
> company to which it is addressed and may contain information which
> is privileged, confidential and prohibited from disclosure or
> unauthorized use under applicable law. If you are not the intended
> recipient of this e-mail, you are hereby notified that any use,
> dissemination, or copying of this e-mail or the information
> contained in this e-mail is strictly prohibited by the sender. If
> you have received this transmission in error, please return the
> material received to the sender and delete all copies from your
> system.