I need to redirect to an external page. I saw this solution, but was not sure how to use it. Where does this exception get thrown? I do not want to instantiate some kind of dummy page.

public class RedirectToExternalException extends
AbstractRestartResponseException
{
      private static final long serialVersionUID = 1L;

      public RedirectToExternalException(String url)
      {

              RequestCycle rc = RequestCycle.get();
              if (rc == null)
              {
                      throw new IllegalStateException(
                                      "This exception can only be
thrown from within request processing cycle");
              }
              else
              {
                      Response r = rc.getResponse();
                      if (!(r instanceof WebResponse))
                      {
                              throw new IllegalStateException(
                                              "This exception can
only be thrown when wicket is processing an
http request");
                      }

                      // abort any further response processing
                      rc.setRequestTarget(new RedirectRequestTarget(url));
              }
      }
}

Thanks,

Warren

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

Reply via email to