/** * Sets the exception settings for development mode for the given application. * * @param application * the new exception settings for development */ public static void setExceptionSettingsForDevelopment(final Application application) { // show the exception page from wicket... application.getExceptionSettings() .setUnexpectedExceptionDisplay(ExceptionSettings.SHOW_EXCEPTION_PAGE); }
/** * @see org.apache.wicket.jmx.ApplicationSettingsMBean#getUnexpectedExceptionDisplay() */ @Override public String getUnexpectedExceptionDisplay() { return application.getExceptionSettings().getUnexpectedExceptionDisplay().toString(); }
/** * @return Application's exception handling settings */ public final ExceptionSettings getExceptionSettings() { checkSettingsAvailable(); if (exceptionSettings == null) { exceptionSettings = new ExceptionSettings(); } return exceptionSettings; }
@Override public void init(WebApplication webApplication) { ExceptionSettings exceptionSettings = webApplication.getExceptionSettings(); exceptionSettings.setAjaxErrorHandlingStrategy(props.getErrorHandlingStrategyDuringAjaxRequests()); exceptionSettings.setThreadDumpStrategy(props.getThreadDumpStrategy()); wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass()) .withDetail("properties", props) .build()); }
if (Application.exists()) notRenderableErrorStrategy = getApplication().getExceptionSettings().getNotRenderableErrorStrategy();
/** * Maps exceptions to their corresponding {@link IRequestHandler}. * * @param e * the current exception * @return the {@link IRequestHandler} for the current exception */ private IRequestHandler internalMap(Exception e) { final Application application = Application.get(); // check if we are processing an Ajax request and if we want to invoke the failure handler if (isProcessingAjaxRequest()) { switch (application.getExceptionSettings().getAjaxErrorHandlingStrategy()) { case INVOKE_FAILURE_HANDLER : return new ErrorCodeRequestHandler(500); } } IRequestHandler handleExpectedExceptions = mapExpectedExceptions(e, application); if (handleExpectedExceptions != null) { return handleExpectedExceptions; } return mapUnexpectedExceptions(e, application); }
.getThreadDumpStrategy(); switch (strategy)
@Override public void init(WebApplication webApplication) { ExceptionSettings exceptionSettings = webApplication.getExceptionSettings(); exceptionSettings.setAjaxErrorHandlingStrategy(props.getErrorHandlingStrategyDuringAjaxRequests()); exceptionSettings.setThreadDumpStrategy(props.getThreadDumpStrategy()); wicketEndpointRepository.add(new WicketAutoConfig.Builder(this.getClass()) .withDetail("properties", props) .build()); }
if (Application.exists()) notRenderableErrorStrategy = getApplication().getExceptionSettings().getNotRenderableErrorStrategy();
/** * Maps exceptions to their corresponding {@link IRequestHandler}. * * @param e * the current exception * @return the {@link IRequestHandler} for the current exception */ private IRequestHandler internalMap(Exception e) { final Application application = Application.get(); // check if we are processing an Ajax request and if we want to invoke the failure handler if (isProcessingAjaxRequest()) { switch (application.getExceptionSettings().getAjaxErrorHandlingStrategy()) { case INVOKE_FAILURE_HANDLER : return new ErrorCodeRequestHandler(500); } } IRequestHandler handleExpectedExceptions = mapExpectedExceptions(e, application); if (handleExpectedExceptions != null) { return handleExpectedExceptions; } return mapUnexpectedExceptions(e, application); }
.getThreadDumpStrategy(); switch (strategy)
protected void initShowExceptionPage() { Properties settings = SettingsUtil.getSettings(); if ("true".equalsIgnoreCase(settings.getProperty("debug.showExceptionPage"))) { getExceptionSettings().setUnexpectedExceptionDisplay( ExceptionSettings.SHOW_EXCEPTION_PAGE); } }
/** * Maps unexpected exceptions to their corresponding {@link IRequestHandler}. * * @param e * the current exception * @param application * the current application object * @return the {@link IRequestHandler} for the current exception */ protected IRequestHandler mapUnexpectedExceptions(Exception e, final Application application) { final ExceptionSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay = application.getExceptionSettings() .getUnexpectedExceptionDisplay(); logger.error("Unexpected error occurred", e); if (ExceptionSettings.SHOW_EXCEPTION_PAGE.equals(unexpectedExceptionDisplay)) { Page currentPage = extractCurrentPage(); return createPageRequestHandler(new PageProvider(new ExceptionErrorPage(e, currentPage))); } else if (ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(unexpectedExceptionDisplay)) { return createPageRequestHandler(new PageProvider( application.getApplicationSettings().getInternalErrorPage())); } // IExceptionSettings.SHOW_NO_EXCEPTION_PAGE return new ErrorCodeRequestHandler(500); }
if (Application.exists()) notRenderableErrorStrategy = getApplication().getExceptionSettings().getNotRenderableErrorStrategy();
/** * @return Application's exception handling settings */ public final ExceptionSettings getExceptionSettings() { checkSettingsAvailable(); if (exceptionSettings == null) { exceptionSettings = new ExceptionSettings(); } return exceptionSettings; }
protected void initShowExceptionPage() { Properties settings = SettingsUtil.getSettings(); if ("true".equalsIgnoreCase(settings.getProperty("debug.showExceptionPage"))) { getExceptionSettings().setUnexpectedExceptionDisplay( ExceptionSettings.SHOW_EXCEPTION_PAGE); } }
/** * Maps unexpected exceptions to their corresponding {@link IRequestHandler}. * * @param e * the current exception * @param application * the current application object * @return the {@link IRequestHandler} for the current exception */ protected IRequestHandler mapUnexpectedExceptions(Exception e, final Application application) { final ExceptionSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay = application.getExceptionSettings() .getUnexpectedExceptionDisplay(); logger.error("Unexpected error occurred", e); if (ExceptionSettings.SHOW_EXCEPTION_PAGE.equals(unexpectedExceptionDisplay)) { Page currentPage = extractCurrentPage(); return createPageRequestHandler(new PageProvider(new ExceptionErrorPage(e, currentPage))); } else if (ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE.equals(unexpectedExceptionDisplay)) { return createPageRequestHandler(new PageProvider( application.getApplicationSettings().getInternalErrorPage())); } // IExceptionSettings.SHOW_NO_EXCEPTION_PAGE return new ErrorCodeRequestHandler(500); }
if (Application.exists()) notRenderableErrorStrategy = getApplication().getExceptionSettings().getNotRenderableErrorStrategy();
/** * Sets the deployment exception settings for the given application. * * @param application * the application * @param applicationRequestCycleListener * the application request cycle listener */ public static void setExceptionSettingsForDeployment(final Application application, final AbstractRequestCycleListener applicationRequestCycleListener) { // show the exception page from us... application.getExceptionSettings() .setUnexpectedExceptionDisplay(ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); // In case of unhandled exception redirect it to a custom page application.getRequestCycleListeners().add(applicationRequestCycleListener); }
getResourceSettings().setUseMinifiedResources(false); getMarkupSettings().setStripWicketTags(false); getExceptionSettings().setUnexpectedExceptionDisplay( ExceptionSettings.SHOW_EXCEPTION_PAGE); getDebugSettings().setComponentUseCheck(true); getResourceSettings().setJavaScriptCompressor(new DefaultJavaScriptCompressor()); getMarkupSettings().setStripWicketTags(true); getExceptionSettings().setUnexpectedExceptionDisplay( ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); getDebugSettings().setComponentUseCheck(false);