org.apache.struts.chain
Class ExceptionCatcher

java.lang.Object
  extended byorg.apache.struts.chain.ExceptionCatcher
All Implemented Interfaces:
org.apache.commons.chain.Command, org.apache.commons.chain.Filter

public class ExceptionCatcher
extends java.lang.Object
implements org.apache.commons.chain.Filter

Intercept any exception thrown by a subsequent Command in this processing chain, and fire the configured exception handler chain after storing the exception that has occurred into the Context.

Version:
$Rev: 55324 $ $Date: 2004-10-22 19:55:27 +0100 (Fri, 22 Oct 2004) $
Author:
Craig R. McClanahan

Field Summary
private  java.lang.String catalogName
           
private  java.lang.String exceptionCommand
           
private  java.lang.String exceptionKey
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
ExceptionCatcher()
           
 
Method Summary
 boolean execute(org.apache.commons.chain.Context context)
          Clear any existing stored exception and pass the context on to the remainder of the current chain.
 java.lang.String getCatalogName()
          Return the name of the Catalog in which to perform lookups, or null for the default Catalog.
 java.lang.String getExceptionCommand()
          Return the name of the command to be executed if an exception occurs.
 java.lang.String getExceptionKey()
          Return the context attribute key under which any thrown exception will be stored.
 boolean postprocess(org.apache.commons.chain.Context context, java.lang.Exception exception)
          If an exception was thrown by a subsequent Command, pass it on to the specified exception handling chain.
 void setCatalogName(java.lang.String catalogName)
          Set the name of the Catalog in which to perform lookups, or null for the default Catalog.
 void setExceptionCommand(java.lang.String exceptionCommand)
          Set the name of the command to be executed if an exception occurs.
 void setExceptionKey(java.lang.String exceptionKey)
          Set the context attribute key under which any thrown exception will be stored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalogName

private java.lang.String catalogName

exceptionCommand

private java.lang.String exceptionCommand

exceptionKey

private java.lang.String exceptionKey

log

private static final org.apache.commons.logging.Log log
Constructor Detail

ExceptionCatcher

public ExceptionCatcher()
Method Detail

getCatalogName

public java.lang.String getCatalogName()

Return the name of the Catalog in which to perform lookups, or null for the default Catalog.


setCatalogName

public void setCatalogName(java.lang.String catalogName)

Set the name of the Catalog in which to perform lookups, or null for the default Catalog.

Parameters:
catalogName - The new catalog name or null

getExceptionCommand

public java.lang.String getExceptionCommand()

Return the name of the command to be executed if an exception occurs.


setExceptionCommand

public void setExceptionCommand(java.lang.String exceptionCommand)

Set the name of the command to be executed if an exception occurs.

Parameters:
exceptionCommand - The name of the chain to be executed

getExceptionKey

public java.lang.String getExceptionKey()

Return the context attribute key under which any thrown exception will be stored.


setExceptionKey

public void setExceptionKey(java.lang.String exceptionKey)

Set the context attribute key under which any thrown exception will be stored.

Parameters:
exceptionKey - The new context attribute key

execute

public boolean execute(org.apache.commons.chain.Context context)
                throws java.lang.Exception

Clear any existing stored exception and pass the context on to the remainder of the current chain.

Specified by:
execute in interface org.apache.commons.chain.Command
Parameters:
context - The Context for the current request
Returns:
false so that processing continues
Throws:
java.lang.Exception

postprocess

public boolean postprocess(org.apache.commons.chain.Context context,
                           java.lang.Exception exception)

If an exception was thrown by a subsequent Command, pass it on to the specified exception handling chain. Otherwise, do nothing.

Specified by:
postprocess in interface org.apache.commons.chain.Filter
Parameters:
context - The Context to be processed by this Filter
exception - The Exception (if any) that was thrown by the last Command that was executed; otherwise null


Copyright ? 2003 - Apache Software Foundation