Class DefaultRequestExceptionHandler

  • All Implemented Interfaces:
    RequestExceptionHandler

    public class DefaultRequestExceptionHandler
    extends java.lang.Object
    implements RequestExceptionHandler
    Default implementation of RequestExceptionHandler that displays the standard ExceptionReport page. Similarly to the servlet spec's standard error handling, the default exception handler allows configuring handlers for specific types of exceptions. The error-page/exception-type configuration in web.xml does not work in Tapestry application as errors are wrapped in Tapestry's exception types (see OperationException and ComponentEventException ). Configurations are flexible. You can either contribute a ExceptionHandlerAssistant to use arbitrary complex logic for error handling or a page class to render for the specific exception. Additionally, exceptions can carry context for the error page. Exception context is formed either from the name of Exception (e.g. SmtpNotRespondingException -> ServiceFailure mapping would render a page with URL /servicefailure/smtpnotresponding) or they can implement ContextAwareException interface. If no configured exception type is found, the default exception page SymbolConstants.EXCEPTION_REPORT_PAGE is rendered. This fallback exception page must implement the ExceptionReporter interface.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object[] formExceptionContext​(java.lang.Throwable exception)
      Form exception context either from the name of the exception, or the context the exception contains if it's of type ContextAwareException
      void handleRequestException​(java.lang.Throwable exception)
      Handles the exception thrown at some point the request was being processed First checks if there was a specific exception handler/page configured for this exception type, it's super class or super-super class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • handleRequestException

        public void handleRequestException​(java.lang.Throwable exception)
                                    throws java.io.IOException
        Handles the exception thrown at some point the request was being processed First checks if there was a specific exception handler/page configured for this exception type, it's super class or super-super class. Renders the default exception page if none was configured.
        Specified by:
        handleRequestException in interface RequestExceptionHandler
        Parameters:
        exception - The exception that was thrown
        Throws:
        java.io.IOException
      • formExceptionContext

        protected java.lang.Object[] formExceptionContext​(java.lang.Throwable exception)
        Form exception context either from the name of the exception, or the context the exception contains if it's of type ContextAwareException
        Parameters:
        exception - The exception that the context is formed for
        Returns:
        Returns an array of objects to be used as the exception context