Have you tried setResponsePage after calling setRedirect(true)?

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, Apr 20, 2009 at 2:14 PM, Antoine van Wel
<[email protected]>wrote:

> One issue I keep running into when programming with Wicket is using
> "urlFor"... I guess I am missing something.
>
> Now I am trying to redirect to a page;
>
> /hello is mounted to HelloPage using an indexed mounting strategy
> /user is mounted to UserPage
>
> when a user types /hello/username, HelloPage captures this and should
> redirect to /user ; for that I am using
>
> throw new RedirectToUrlException(urlFor(UserPage.class,
> params).toString());
>
>
> However, urlFor will generate "../user/username"  instead of /user/username
> which will result in a wrong URL in a browser.
>
> Using RequestUtils.toAbsolutePath ( .. ) on it will break my unit test,
> since it doesn't like the full path including http://... in combination
> with
> the RedirectToUrlException. (It won't find the UserPage class).
>
> Any thoughts what's the best way to tackle this? Now I just strip off all
> the "../" which is being output by urlFor, but that really feels like a
> dirty hack.
>
>
> Using 1.3.5
>
>
> - Antoine
>
>
> PS the common setResponsePage or throw RestartResponseException won't do in
> this case, since I want the URL in the browser to be displaying
> /user/username
>
>
> --
>
> --8<--8<--
> take your photos everywhere you go - http://www.memolio.com
> --8<--8<--
> We don't see things as they are, we see things as we are. - Anais Nin
> Whether you think you can or whether you think you can't, you're right. -
> Henry Ford
> --8<--8<--
>

Reply via email to