users@jersey.java.net

Re: [Jersey] URL redirect/Forward in Jersey

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 25 Nov 2009 12:03:51 +0100

On Nov 25, 2009, at 11:43 AM, Anil Kumar Veeramalli wrote:

> Hi,
>
> I am trying to forward/redirect result.jsp page from my code. I am
> not able to find correct API.
>
> Please help me out on this.
>
> I tried using HttpResponseContext,HttpServerletContext...
>

If you want to perform an "internal" forward you can return an
instance of Viewable:

   https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/view/Viewable.html

However be careful. If you are using the Jersey ServletContainer as a
servlet and declare a url pattern of "/*" it will not work. This is
because the Jersey servlet will swallow all requests. In such a case
you need to use the Jersey ServletContainer as a servlet filter.

Paul.