users@jersey.java.net

[Jersey] Re: Handling a special URI.

From: Rahul Babbar <rahul.babbar1_at_gmail.com>
Date: Thu, 2 Dec 2010 13:03:04 -0800

Hi Jan,

I am trying to avoid writing the piece of code in the resource handling
/foo, because it needs to happen for all the resources.

By reverse proxy, do you mean a Filter, which will see the request URL, and
if it has the keyword CUSTOM, it will direct it some other servlet.

Thanks, yes, that could be done....

I am trying to look for options to accomplish this and was wondering if
Jersey provided any such feature(although i think its too weird a feature to
ask for).

Thank you

Rahul


On Thu, Dec 2, 2010 at 12:39 PM, Jan Algermissen <algermissen1971_at_mac.com>wrote:

> Rahul,
>
> On Dec 2, 2010, at 9:30 PM, Rahul Babbar wrote:
>
> > Hello All,
> >
> > I have a few Jersey resources which handle different URIs.
> >
> > Lets say i have two resources, handling /foo and /bar.
> >
> > I have a requirement in which any URI of the form /<anything>/{Id}/{SOME
> KEYWORD}/{name} should not go to the resource handling foo or bar even
> though anything is foo or bar.
> >
> > Eg, lets say, the URI is of the form /foo or /foo/1 or /bar or /bar/1 ,
> it will go to the corresponding resource handling the URI.
> >
> > However if the URI is of form /foo/CUSTOM/1 or /bar/CUSTOM/1, i need it
> to go to a different resource directly.
>
> I think this is problematic with JAX-RS. You could do it by handling /foo/
> with one resource and then dispatch to other based on parameters, but that
> IMHO works against the simplicity of JAX-RS.
>
> Have you considered using a rewriting reverse proxy in front of Jersey?
>
> Jan
>
>
> >
> > Sorry but i know this requirement is a bit weird, but is there a way to
> accomplish it?
> >
> > Thank you
> >
> > Rahul
>
>