users@jersey.java.net

Re: [Jersey] invoking Jersey methods by URI internally

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 20 Jan 2009 15:08:42 +0100

On Jan 20, 2009, at 2:49 PM, Gabor Szokoli wrote:

> On Mon, Jan 19, 2009 at 12:54 PM, Paul Sandoz <Paul.Sandoz_at_sun.com>
> wrote:
>> HI Gabor,
>>
>> I think the only way this can be done as you want is for the
>> service to make
>> a request to itself. This may seem a little odd, but the sub-
>> locators and
>> resource methods would need to be invoked to return the JAXB object
>> you
>> require.
>
> I'll resort to resolving the URI myself then.
>
> Is it an unreasonable feature request BTW?
>
>

No, i don't think so. It is just that the only way to do what you want
is to re-invoke the application since it decides on how to route the
URI, using @Path and sub-resource locators, to the appropriate
resource method that returns an entity.

There may be other ways to validate some URIs. For example you may be
able to validate the left hand side of a URI based on the current
request URI (or the URI that matched the parent) and then the left
hand side of the URI could reuse a template from a resource class.

Paul.