users@jersey.java.net

Re: [Jersey] howto RESTfully relate resources?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 09 Feb 2010 13:15:15 -0500

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:
>
> https://jersey.dev.java.net/issues/show_bug.cgi?id=436
>
> 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.

Marc.

>
>> 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
>> users_at_jersey.dev.java.net
>>
>> To
>> users_at_jersey.dev.java.net
>> 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, 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.
>>
>