Interface Filter
-
- All Superinterfaces:
Command
- All Known Implementing Classes:
DispatchLookupCommand,LookupCommand,PathInfoMapper,RequestParameterMapper,ServletPathMapper
public interface Filter extends Command
A
Filteris a specializedCommandthat also expects theChainthat is executing it to call thepostprocess()method if it called theexecute()method. This promise must be fulfilled in spite of any possible exceptions thrown by theexecute()method of thisCommand, or any subsequentCommandwhoseexecute()method was called. The owningChainmust call thepostprocess()method of eachFilterin aChainin reverse order of the invocation of theirexecute()methods.The most common use case for a
Filter, as opposed to aCommand, is where potentially expensive resources must be acquired and held until the processing of a particular request has been completed, even if execution is delegated to a subsequentCommandvia theexecute()returningfalse. AFiltercan reliably release such resources in thepostprocess()method, which is guaranteed to be called by the owningChain.- Version:
- $Revision: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
- Author:
- Craig R. McClanahan
-
-
Field Summary
-
Fields inherited from interface org.apache.commons.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanpostprocess(Context context, java.lang.Exception exception)Execute any cleanup activities, such as releasing resources that were acquired during theexecute()method of thisFilterinstance.
-
-
-
Method Detail
-
postprocess
boolean postprocess(Context context, java.lang.Exception exception)
Execute any cleanup activities, such as releasing resources that were acquired during the
execute()method of thisFilterinstance.- Parameters:
context- TheContextto be processed by thisFilterexception- TheException(if any) that was thrown by the lastCommandthat was executed; otherwisenull- Returns:
- If a non-null
exceptionwas "handled" by this method (and therefore need not be rethrown), returntrue; otherwise returnfalse - Throws:
java.lang.IllegalArgumentException- ifcontextisnull
-
-