You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Garth Dahlstrom <ir...@gmail.com> on 2010/08/05 18:32:01 UTC

Stupid question about redirecting to a relative path outside context root...

I'm sure this is a silly question, but I've been unable to find an answer to it through searching the docs and the old click book I have...  

I'm trying to redirect a user out of the context root.    Effectively passing them a "Location: /" type redirect header.   

I've tried to do this via setRedirect, setForward and setPath, however these all resolve anything starting with a "/" to the context root of application itself, which though handy in most cases is not what I'm after here.

Is there a way to redirect a user to the root of the web server, rather then the root of the context path? 

Thanks,

-G


Re: Stupid question about redirecting to a relative path outside context root...

Posted by Garth Dahlstrom <ir...@gmail.com>.
To answer my own questions, I guess the path of least resistance is just to access the Response object directly like this:

> getContext().getResponse().sendRedirect("/");


-G

On 2010-08-05, at 12:32 PM, Garth Dahlstrom wrote:

> I'm sure this is a silly question, but I've been unable to find an answer to it through searching the docs and the old click book I have...  
> 
> I'm trying to redirect a user out of the context root.    Effectively passing them a "Location: /" type redirect header.   
> 
> I've tried to do this via setRedirect, setForward and setPath, however these all resolve anything starting with a "/" to the context root of application itself, which though handy in most cases is not what I'm after here.
> 
> Is there a way to redirect a user to the root of the web server, rather then the root of the context path? 
> 
> Thanks,
> 
> -G
>