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

Reply via email to