try:
RequestCycle.get().setRequestTarget(new RedirectRequestTarget(url));
Warren Bell wrote:
>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/Redirecting-to-external-URL-tp21245727p21246262.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]