Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.valves
Class ErrorDispatcherValve

    java.lang.Object
      |
      +--org.apache.catalina.valves.ValveBase
            |
            +--org.apache.catalina.valves.ErrorDispatcherValve

All Implemented Interfaces:
  Contained, Valve

public class ErrorDispatcherValve
extends ValveBase

Implementation of a Valve that handles the error dispatch (that is, will forward to the appropriate error page if necessary).

This Valve should be attached at the Host level, although it will work if attached to a Context.

WARNING: This valve is necessary for Servlet API compliance.

Version:
  $Revision: 1.11 $ $Date: 2003/02/19 14:42:40 $
Author:
  Remy Maucherat, Craig R. McClanahan

Field Summary
`protected int` | `debug` The debugging detail level for this component.
`protected static java.lang.String` | `info` The descriptive information related to this implementation.
`protected static StringManager` | `sm` The StringManager for this package.

Fields inherited from class org.apache.catalina.valves.ValveBase
`container`

Constructor Summary
`ErrorDispatcherValve()`

Method Summary
`protected boolean` | `custom(Request request, Response response, ErrorPage errorPage)` Handle an HTTP status code or Java exception by forwarding control to the location included in the specified errorPage object.
`protected static ErrorPage` | `findErrorPage(Context context, java.lang.Throwable exception)` 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.
`java.lang.String` | `getInfo()` Return descriptive information about this Valve implementation.
`void` | `invoke(Request request, Response response, ValveContext context)` Invoke the next Valve in the sequence.
`protected void` | `log(java.lang.String message)` Log a message on the Logger associated with our Container (if any).
`protected void` | `log(java.lang.String message, java.lang.Throwable throwable)` Log a message on the Logger associated with our Container (if any).
`protected void` | `status(Request request, Response response)` Handle the HTTP status code (and corresponding message) generated while processing the specified Request to produce the specified Response.
`protected void` | `throwable(Request request, Response response, java.lang.Throwable throwable)` Handle the specified Throwable encountered while processing the specified Request to produce the specified Response.
`java.lang.String` | `toString()` Return a String rendering of this object.

Methods inherited from class org.apache.catalina.valves.ValveBase
`getContainer, getDebug, setContainer, setDebug`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### debug

    protected int debug

  The debugging detail level for this component.

### info

    protected static final java.lang.String info

  The descriptive information related to this implementation.

  See Also:
    Constant Field Values

### sm

    protected static StringManager sm

  The StringManager for this package.

Constructor Detail

### ErrorDispatcherValve

    public ErrorDispatcherValve()

Method Detail

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this Valve implementation.

  Specified by:
    `getInfo` in interface `Valve`
  Overrides:
    `getInfo` in class `ValveBase`

### invoke

    public void invoke(Request request,
                       Response response,
                       ValveContext context)
                throws java.io.IOException,
                       javax.servlet.ServletException

  Invoke the next Valve in the sequence. When the invoke returns, check the response state, and output an error report is necessary.

  Specified by:
    `invoke` in interface `Valve`
  Specified by:
    `invoke` in class `ValveBase`
  Parameters:
    `request` - The servlet request to be processed
    `response` - The servlet response to be created
    `context` - The valve context used to invoke the next valve in the current processing pipeline
  Throws:
    `java.io.IOException` - if an input/output error occurs
    `javax.servlet.ServletException` - if a servlet error occurs

### toString

    public java.lang.String toString()

  Return a String rendering of this object.

  Overrides:
    `toString` in class `java.lang.Object`

### throwable

    protected void throwable(Request request,
                             Response response,
                             java.lang.Throwable throwable)

  Handle the specified Throwable encountered while processing the specified Request to produce the specified Response. Any exceptions that occur during generation of the exception report are logged and swallowed.

  Parameters:
    `request` - The request being processed
    `response` - The response being generated

### status

    protected void status(Request request,
                          Response response)

  Handle the HTTP status code (and corresponding message) generated while processing the specified Request to produce the specified Response. Any exceptions that occur during generation of the error report are logged and swallowed.

  Parameters:
    `request` - The request being processed
    `response` - The response being generated

### findErrorPage

    protected static ErrorPage findErrorPage(Context context,
                                             java.lang.Throwable exception)

  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 `null`.

  Parameters:
    `context` - The Context in which to search
    `exception` - The exception for which to find an ErrorPage

### custom

    protected boolean custom(Request request,
                             Response response,
                             ErrorPage errorPage)

  Handle an HTTP status code or Java exception by forwarding control to the location included in the specified errorPage object. It is assumed that the caller has already recorded any request attributes that are to be forwarded to this page. Return `true` if we successfully utilized the specified error page location, or `false` if the default error report should be rendered.

  Parameters:
    `request` - The request being processed
    `response` - The response being generated
    `errorPage` - The errorPage directive we are obeying

### log

    protected void log(java.lang.String message)

  Log a message on the Logger associated with our Container (if any).

  Parameters:
    `message` - Message to be logged

### log

    protected void log(java.lang.String message,
                       java.lang.Throwable throwable)

  Log a message on the Logger associated with our Container (if any).

  Parameters:
    `message` - Message to be logged
    `throwable` - Associated exception

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.