Package org.apache.struts.chain.commands
Class ExceptionCatcher
java.lang.Object
org.apache.struts.chain.commands.ActionCommandBase
org.apache.struts.chain.commands.ExceptionCatcher
- All Implemented Interfaces:
Command<ActionContext>,Filter<ActionContext>,ActionCommand
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.-
Field Summary
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanexecute_(ActionContext actionCtx) Clear any existing stored exception and pass thecontexton to the remainder of the current chain.Return the name of theCatalogin which to perform lookups, ornullfor the defaultCatalog.Return the name of the command to be executed if an exception occurs.protected Command<ActionContext> Return the command to be executed if an exception occurs.booleanpostprocess(ActionContext actionCtx, Exception exception) If an exception was thrown by a subsequentCommand, pass it on to the specified exception handling chain.voidsetCatalogName(String catalogName) Set the name of theCatalogin which to perform lookups, ornullfor the defaultCatalog.voidsetExceptionCommand(String exceptionCommand) Set the name of the command to be executed if an exception occurs.Methods inherited from class org.apache.struts.chain.commands.ActionCommandBase
execute
-
Constructor Details
-
ExceptionCatcher
public ExceptionCatcher()
-
-
Method Details
-
getCatalogName
Return the name of theCatalogin which to perform lookups, ornullfor the defaultCatalog.- Returns:
- Name of catalog to use, or null
-
setCatalogName
Set the name of theCatalogin which to perform lookups, ornullfor the defaultCatalog.- Parameters:
catalogName- The new catalog name ornull
-
getExceptionCommand
Return the name of the command to be executed if an exception occurs.- Returns:
- The name of the command to be executed on an exception
-
setExceptionCommand
Set the name of the command to be executed if an exception occurs.- Parameters:
exceptionCommand- The name of the chain to be executed
-
execute_
Clear any existing stored exception and pass thecontexton to the remainder of the current chain.- Specified by:
execute_in classActionCommandBase- Parameters:
actionCtx- TheContextfor the current request- Returns:
falseso that processing continues- Throws:
Exception- On any error
-
postprocess
If an exception was thrown by a subsequentCommand, pass it on to the specified exception handling chain. Otherwise, do nothing.- Specified by:
postprocessin interfaceFilter<ActionContext>- Parameters:
actionCtx- TheActionContextto be processed by thisFilterexception- TheException(if any) that was thrown by the lastCommandthat was executed; otherwisenull- Returns:
- TRUE if post processing an exception occurred and the exception processing chain invoked
- Throws:
IllegalStateException- If exception throws exception
-
lookupExceptionCommand
Return the command to be executed if an exception occurs.- Returns:
- The command to be executed if an exception occurs
- Throws:
IllegalArgumentException- If catalog cannot be foundIllegalStateException- If command property is not specified
-