    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.filters.ErrorFilter

    java.lang.Object
       |
       +----w3c.tools.store.AttributeHolder
               |
               +----w3c.tools.store.Resource
                       |
                       +----w3c.tools.store.ResourceFrame
                               |
                               +----w3c.jigsaw.resources.ResourceFilter
                                       |
                                       +----w3c.jigsaw.filters.ErrorFilter

public class ErrorFilter
extends ResourceFilter

The ErroFilter class allows you to customize and enhance error messages. This filter will catch all errors on their way back to the client, and use internal requests to provide a nice customizable error message.

You can use any resources (including server side includes, content negotiated resources, etc) to deliver error messages.

##

ATTR_BASEURL
  Attribute index - The base URL for error messages.
ATTR_EXTENSION
  Attribute index - The common extension for error messages (can be null).
ERRED
  A request state, to avoid looping on errors about errors.

##

ErrorFilter()

##

exceptionFilter(Request, HTTPException, HTTPFilter[], int)
  We do catch exceptions, just in case we can customize the error.
getBaseURL()
  Get the base URL describing the error directory.
getErrorResource(int)
  Compute the path for the given status code.
getExtension()
  Get the value of the extension attribute.
ingoingFilter(Request)
  This one just makes sure the outgoing filter gets called.
initialize(Object[])
  Initialize the filter.
outgoingFilter(Request, Reply)
  Re-compute error message.

##

ERRED

     protected static final String ERRED

  A request state, to avoid looping on errors about errors.

ATTR_BASEURL

     protected static int ATTR_BASEURL

  Attribute index - The base URL for error messages.

ATTR_EXTENSION

     protected static int ATTR_EXTENSION

  Attribute index - The common extension for error messages (can be null).

##

ErrorFilter

     public ErrorFilter()

##

getBaseURL

     public String getBaseURL()

  Get the base URL describing the error directory.

  Returns:
    The base URL.

getExtension

     public String getExtension()

  Get the value of the extension attribute.

  Returns:
    A String, for the common extension to error messages, or null if undefined.

getErrorResource

     public String getErrorResource(int status)

  Compute the path for the given status code.

  Returns:
    A path leading to the customizable error message for the given status code.

ingoingFilter

     public Reply ingoingFilter(Request request) throws HTTPException

  This one just makes sure the outgoing filter gets called.

  Parameters:
    request - The original request to be handled.
  Overrides:
    ingoingFilter in class ResourceFilter

outgoingFilter

     public Reply outgoingFilter(Request request,
                                 Reply reply) throws HTTPException

  Re-compute error message. This filter uses internal redirection to get the error message body. In case of failure, the original reply is returned, otherwise, a new reply is gotten from the appropriate error resource, and is returned.

  Parameters:
    request - The request that has been handled.
    reply - The reply, as emited by the original resource.
  Returns:
    A new error reply, having the same status code, and authentication information then the given reply, but enhanced with the error resource body.
  Overrides:
    outgoingFilter in class ResourceFilter

exceptionFilter

     public Reply exceptionFilter(Request request,
                                  HTTPException ex,
                                  HTTPFilter filters[],
                                  int idx)

  We do catch exceptions, just in case we can customize the error.

  Parameters:
    request - The request tha triggered the exception.
    ex - The exception.
    filters - Remaining filters to be called.
    idx - Current filter index within above array.
  Overrides:
    exceptionFilter in class ResourceFilter

initialize

     public void initialize(Object values[])

  Initialize the filter.

  Overrides:
    initialize in class ResourceFilter

    All Packages  Class Hierarchy  This Package  Previous  Next  Index