Example usage for org.apache.wicket.request.flow RedirectToUrlException RedirectToUrlException

List of usage examples for org.apache.wicket.request.flow RedirectToUrlException RedirectToUrlException

Introduction

In this page you can find the example usage for org.apache.wicket.request.flow RedirectToUrlException RedirectToUrlException.

Prototype

public RedirectToUrlException(final String redirectUrl, final int statusCode) 

Source Link

Document

Construct.

Usage

From source file:fiftyfive.wicket.shiro.markup.LogoutPage.java

License:Apache License

/**
 * Called by {@link #onBeforeRender} after {@link #logout} to redirect to another page.
 * By default this is the application home page. However if a {@code "to"} page parameter
 * was provided, assume it is a URI and redirect to that URI instead. For security reasons,
 * full URLs (i.e. something starting with {@code http}) are ignored.
 *
 * @throws RedirectToUrlException to cause Wicket to perform a 302 redirect
 *///from  w  w  w  .  j a  v a  2  s .c o m
protected void redirectAfterLogout() throws RedirectToUrlException {
    StringValue to = getPageParameters().get("to");

    // If "to" param was not specified, or was erroneously set to
    // an absolute URL (i.e. containing a ":" like "http://blah"), then fall back
    // to the home page.
    if (null == to || to.isNull() || to.toString().indexOf(":") >= 0) {
        to = StringValue.valueOf(urlFor(getApplication().getHomePage(), null));
    }

    throw new RedirectToUrlException(to.toString(), 302);
}

From source file:fiftyfive.wicket.util.ParameterSpec.java

License:Apache License

/**
 * Immediately halt the request cycle and force a 302 redirect to the
 * bookmarkable page managed by this ParameterSpec. Page parameters will
 * be passed to the page based on the specified model.
 * /*from w  w w  .  j  a  v  a 2  s.  c  o  m*/
 * @throws RedirectToUrlException to force Wicket to halt the request
 */
public void redirect(IModel<T> model) {
    CharSequence url = RequestCycle.get().urlFor(this.pageClass, createParameters(model.getObject()));
    throw new RedirectToUrlException(url.toString(), 302);
}

From source file:org.bosik.diacomp.web.frontend.wicket.pages.register.sent.RegistrationSentPage.java

License:Open Source License

/**
 * Called from browser when URL typed directly; redirects to home page
 *///www  .j av  a  2s  . co m
public RegistrationSentPage() {
    super();
    CharSequence url = urlFor(getApplication().getHomePage(), null);
    throw new RedirectToUrlException(url.toString(), HttpServletResponse.SC_MOVED_TEMPORARILY);
}

From source file:org.bosik.diacomp.web.frontend.wicket.pages.restore.sent.RestoreSentPage.java

License:Open Source License

/**
 * Called from browser when URL typed directly; redirects to home page
 *//*from ww  w  .  ja  v  a 2 s.  c  o m*/
public RestoreSentPage() {
    super();
    CharSequence url = urlFor(getApplication().getHomePage(), null);
    throw new RedirectToUrlException(url.toString(), HttpServletResponse.SC_MOVED_TEMPORARILY);
}