Search in sources :

Example 6 with ErrorPage

use of org.apache.catalina.deploy.ErrorPage in project Payara by payara.

the class StandardHostValve method findErrorPage.

/**
 * Find and return the ErrorPage instance for the specified exception's
 * class, or an ErrorPage instance for the closest superclass for which
 * there is such a definition.  If no associated ErrorPage instance is
 * found, return <code>null</code>.
 *
 * @param context The Context in which to search
 * @param exception The exception for which to find an ErrorPage
 */
protected static ErrorPage findErrorPage(Context context, Throwable exception) {
    if (exception == null)
        return (null);
    Class<?> clazz = exception.getClass();
    String name = clazz.getName();
    while (!Object.class.equals(clazz)) {
        ErrorPage errorPage = context.findErrorPage(name);
        if (errorPage != null)
            return (errorPage);
        clazz = clazz.getSuperclass();
        if (clazz == null)
            break;
        name = clazz.getName();
    }
    return (null);
}
Also used : ErrorPage(org.apache.catalina.deploy.ErrorPage)

Aggregations

ErrorPage (org.apache.catalina.deploy.ErrorPage)6 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 ClientAbortException (org.apache.catalina.connector.ClientAbortException)2 ServletContext (javax.servlet.ServletContext)1 ServletRequest (javax.servlet.ServletRequest)1 ServletResponse (javax.servlet.ServletResponse)1 ApplicationDispatcher (org.apache.catalina.core.ApplicationDispatcher)1 StandardContext (org.apache.catalina.core.StandardContext)1 StandardHost (org.apache.catalina.core.StandardHost)1 FilterMap (org.apache.catalina.deploy.FilterMap)1 Property (org.jvnet.hk2.config.types.Property)1