* a redirect. However, if the request is an ajax one, force a redirect, as that is the
* only way to make the browser show the error page.
*/
private IRequestHandler createErrorPageHandler(RequestCycle cycle, Class<? extends Page> page)
{
RedirectPolicy redirectPolicy = RedirectPolicy.NEVER_REDIRECT;
if(cycle.getRequest() instanceof WebRequest && ((WebRequest) cycle.getRequest()).isAjax())
{
redirectPolicy = RedirectPolicy.ALWAYS_REDIRECT;
}