Re: Howto test redirect to non-wicket base page

2009-10-12 Thread Erik van Oosten

Per,

You can also throw a RestartResponseException or a subclass thereof. 
That is the recommended way within a constructor anyway. For you it 
would be RedirectToUrlException (or something like that).


Regards,
Erik.


Per Newgro wrote:

Hi *,

i would like to test behavior of my page. In constructor there is a redirect if 
page parameter not set. But the redirect target is a url and not a wicket page 
instance. What is the best attribute to add my assertion to?

MyPage(PageParams p) {
  if (p.get(xyz) == null) {
redirectTo(http://www.myurl.ch;);
  }
  add(new Label(Rendered);
}

void redirectTo(String url) {
  getRequestCycle().setRedirect(true);
  getRequestCycle().setRequestTarget(new RedirectRequestTarget(url));
}

lastRenderedPage is null so i can't add my assertion to this.

Cheers
Per
  



--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Howto test redirect to non-wicket base page

2009-10-12 Thread Per Newgro

Thanks Erik,

this is definitly worth a shot. There seem to be many new classes in 
1.4. So i have to dig deeper into wicket again.


Thanks for showing me the light on this.
Per

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org