users@jersey.java.net

Re: [Jersey] invoking Jersey methods by URI internally

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 19 Jan 2009 12:54:14 +0100

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.

There could be a way to optimize this internal invocation so the
response entity can be obtained directly. I am sure there are some
edge cases like security thus there needs to be some sort of context
under which such requests are invoked.

Of course you can do this using the client API but it would not be
very efficient.

Paul.

On Jan 17, 2009, at 8:33 AM, Gabor Szokoli wrote:

> Hi,
>
> I'd like to reuse Jersey's method dispatch facility to resolve URIs
> for me from within other request-handling methods:
>
> Inspired by a current discussion on rest-discuss regarding references,
> I tried to put more HATEOS into my service.
> But if I send out resource references as URIs, then I should also
> accept them in PUT/POST message bodies for shuffling stuff around
> between containers, etc. Trying to implement this I realized I'd have
> to "repeat myself" (and Jersey code) when implementing a lookup method
> from URIs to domain objects.
> Lucky for me, my domain objects are my JAXB entities (for now).
> So I thought my Jersey method while processing a request might hook
> into Jersey somewhere halfway in the request processing pipe, so a
> (possibly relative) URI in context of the original request would be
> resolved into the JAXB entity it represents as if a GET request has
> been issued for it.
>
> Am I making myself clear?
> Is something like this possible?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>