org.w3c.jigsaw.filters
Class ErrorFilter
java.lang.Object
|
+--org.w3c.tools.resources.AttributeHolder
|
+--org.w3c.tools.resources.Resource
|
+--org.w3c.tools.resources.FramedResource
|
+--org.w3c.tools.resources.ResourceFrame
|
+--org.w3c.tools.resources.ResourceFilter
|
+--org.w3c.jigsaw.filters.ErrorFilter
- public class ErrorFilter
- extends org.w3c.tools.resources.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.
Field Summary |
protected static int |
ATTR_BASEURL
Attribute index - The base URL for error messages. |
protected static int |
ATTR_EXTENSION
Attribute index - The common extension for error messages (can be null). |
protected static java.lang.String |
ERRED
A request state, to avoid looping on errors about errors. |
Fields inherited from class org.w3c.tools.resources.ResourceFrame |
filterClass,
frameListener,
resource |
Fields inherited from class org.w3c.tools.resources.FramedResource |
ATTR_OID,
attrListener,
debugEvent,
event_disabled,
framesRef,
structListener |
Fields inherited from class org.w3c.tools.resources.Resource |
ATTR_CONTEXT,
ATTR_HELP_URL,
ATTR_IDENTIFIER,
ATTR_LAST_MODIFIED,
ATTR_PARENT,
ATTR_RESOURCE_FRAMES,
ATTR_STORE_ENTRY,
ATTR_URL |
Fields inherited from class org.w3c.tools.resources.AttributeHolder |
attributes,
slowpickle,
values |
Method Summary |
org.w3c.tools.resources.ReplyInterface |
exceptionFilter(org.w3c.tools.resources.RequestInterface request,
org.w3c.tools.resources.ProtocolException ex,
org.w3c.tools.resources.FilterInterface[] filters,
int idx)
We do catch exceptions, just in case we can customize the error. |
java.lang.String |
getBaseURL()
Get the base URL describing the error directory. |
java.lang.String |
getErrorResource(int status)
Compute the path for the given status code. |
java.lang.String |
getExtension()
Get the value of the extension attribute. |
org.w3c.tools.resources.ReplyInterface |
ingoingFilter(org.w3c.tools.resources.RequestInterface request)
This one just makes sure the outgoing filter gets called. |
void |
initialize(java.lang.Object[] values)
|
org.w3c.tools.resources.ReplyInterface |
outgoingFilter(org.w3c.tools.resources.RequestInterface req,
org.w3c.tools.resources.ReplyInterface rep)
Re-compute error message. |
Methods inherited from class org.w3c.tools.resources.ResourceFilter |
getTargetResource,
ingoingFilter,
lookup,
outgoingFilter,
outputFilter |
Methods inherited from class org.w3c.tools.resources.ResourceFrame |
addFrameEventListener,
attributeChanged,
checkRequest,
eventDisabled,
fireFrameEvent,
frameModified,
getFilters,
getFilters,
getFrameReference,
getResource,
getResourceReference,
getSpaceEntry,
getURLPath,
lookupFilters,
lookupFrames,
perform,
postFrameEvent,
processEvent,
registerResource,
removeFrameEventListener,
setValue,
unregisterResource,
updateDefaultChildAttributes |
Methods inherited from class org.w3c.tools.resources.FramedResource |
addAttributeChangedListener,
addStructureChangedListener,
collectFramesReference,
delete,
disableEvent,
displayEvent,
enableEvent,
fireAttributeChangeEvent,
fireStructureChangedEvent,
fireStructureChangedEvent,
frameAdded,
frameRemoved,
getClone,
getFrame,
getFrame,
getFrameReference,
getFrameReference,
getFramesReference,
getOid,
markModified,
notifyUnload,
performFrames,
postAttributeChangeEvent,
postEvent,
postStructureChangedEvent,
postStructureChangedEvent,
registerFrame,
registerFrameIfNone,
removeAttributeChangedListener,
removeStructureChangedListener,
unregisterFrame |
Methods inherited from class org.w3c.tools.resources.Resource |
acceptUnload,
checkMultipleLock,
collectFrames,
getContext,
getFrame,
getFrames,
getHelpURL,
getHelpURL,
getIdentifier,
getLastModified,
getParent,
getServer,
getSpace,
getStoreEntry,
getValue,
getValue,
isInitialized,
setContext,
setContext,
setValue,
updateAttributes |
Methods inherited from class org.w3c.tools.resources.AttributeHolder |
definesAttribute,
definesAttribute,
getAttributes,
getBoolean,
getChar,
getClone,
getClone,
getDouble,
getFloat,
getInt,
getLong,
getString,
getValue,
initialize,
lookupAttribute,
pickle,
print,
setBoolean,
setChar,
setDouble,
setFloat,
setInt,
setLong,
setString,
setValue,
unpickle,
unpickle,
unpickle,
unpickleInstance,
unpickleInstance |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ERRED
protected static final java.lang.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 java.lang.String getBaseURL()
- Get the base URL describing the error directory.
- Returns:
- The base URL.
getExtension
public java.lang.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 java.lang.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 org.w3c.tools.resources.ReplyInterface ingoingFilter(org.w3c.tools.resources.RequestInterface request)
throws org.w3c.tools.resources.ProtocolException
- This one just makes sure the outgoing filter gets called.
- Parameters:
request
- The original request to be handled.- Throws:
- org.w3c.tools.resources.ProtocolException - If processing should be interrupted,
because an abnormal situation occured.
- Overrides:
- ingoingFilter in class org.w3c.tools.resources.ResourceFilter
outgoingFilter
public org.w3c.tools.resources.ReplyInterface outgoingFilter(org.w3c.tools.resources.RequestInterface req,
org.w3c.tools.resources.ReplyInterface rep)
throws org.w3c.tools.resources.ProtocolException
- 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.
- Throws:
- org.w3c.tools.resources.ProtocolException - If processing should be interrupted,
because an abnormal situation occured.
- Overrides:
- outgoingFilter in class org.w3c.tools.resources.ResourceFilter
exceptionFilter
public org.w3c.tools.resources.ReplyInterface exceptionFilter(org.w3c.tools.resources.RequestInterface request,
org.w3c.tools.resources.ProtocolException ex,
org.w3c.tools.resources.FilterInterface[] 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 org.w3c.tools.resources.ResourceFilter
initialize
public void initialize(java.lang.Object[] values)
- Overrides:
- initialize in class org.w3c.tools.resources.FramedResource