* org.apache.wicket.RequestCycle)
*/
public void respond(RuntimeException e, RequestCycle requestCycle)
{
// If application doesn't want debug info showing up for users
final Application application = Application.get();
final IExceptionSettings settings = application.getExceptionSettings();
final Page responsePage = requestCycle.getResponsePage();
Page override = onRuntimeException(responsePage, e);
if (override != null)
{
throw new RestartResponseException(override);
}
else if (e instanceof AuthorizationException)
{
// are authorization exceptions always thrown before the real
// render?
// else we need to make a page (see below) or set it hard to a
// redirect.
Class accessDeniedPageClass = application.getApplicationSettings()
.getAccessDeniedPage();
throw new RestartResponseAtInterceptPageException(accessDeniedPageClass);
}
else if (e instanceof PageExpiredException)
{
Class pageExpiredErrorPageClass = application.getApplicationSettings()
.getPageExpiredErrorPage();
boolean mounted = isPageMounted(pageExpiredErrorPageClass);
RequestCycle.get().setRedirect(mounted);
throw new RestartResponseException(pageExpiredErrorPageClass);
}
else if (settings.getUnexpectedExceptionDisplay() != IExceptionSettings.SHOW_NO_EXCEPTION_PAGE)
{
// we do not want to redirect - we want to inline the error output
// and preserve the url so when the refresh button is pressed we
// rerun the code that caused the error
requestCycle.setRedirect(false);
// figure out which error page to show
Class internalErrorPageClass = application.getApplicationSettings()
.getInternalErrorPage();
Class responseClass = responsePage != null ? responsePage.getClass() : null;
if (responseClass != internalErrorPageClass &&
settings.getUnexpectedExceptionDisplay() == IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)