Re: [Jersey] howto RESTfully relate resources?

From: <>
Date: Tue, 9 Feb 2010 12:58:57 -0600

Yes, I think it is a new request and unrelated to the original. My other
post crossed yours and Paul's, so I'll repeat the idea here:

public Response relateFoo(@QueryParam("fooUrl") FooResource aFooResource)
                // the jersey container will process the fooUrl parameter
in order to come up with the FooResource parameter

doing it this way the application programmer would not be aware of another
request or a second container invocation, it would be completely internal
to the container....


Marc Hadley <Marc.Hadley_at_Sun.COM>
Sent by: Marc.Hadley_at_Sun.COM
02/09/2010 12:15 PM
Please respond to


Re: [Jersey] howto RESTfully relate resources?

On Feb 9, 2010, at 12:16 PM, Paul Sandoz wrote:
>> Passing the parameter is not the problem. I want to process that
parameter URI the same way the jersey container does and get a resource
object out of it.
> Ah yes, see issue:
> We need to re-invoke into the container, which is certainly possible,
but we have to be careful as what does the request re-invocation mean?
should the request be cloned, what about the entity etc? i.e. we need to
be very clear on the rules.
It sounds to me like its a completely new request rather than a clone of
the existing one. Essentially we need to be able to invoke steps 1 & 2 of
the spec matching algorithm and return the object that would normally
become input for step 3. Fortunately neither the HTTP request method nor
Content-Type or Accept headers are considered when selecting the resource
object in steps 1 & 2 so only a URI should be required.


>> I want to process all the rules except the last one for HTTP method and
the creation of the representation. I think all the code to do this is
already in the container,
>> just need to find out how to get to it...
>> Paul Sandoz <Paul.Sandoz_at_Sun.COM>
>> Sent by: Paul.Sandoz_at_Sun.COM
>> 02/08/2010 04:38 AM
>> Please respond to
>> To
>> cc
>> Subject
>> Re: [Jersey] howto RESTfully relate resources?
>> 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, 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)
>> 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.

To unsubscribe, e-mail:
For additional commands, e-mail: