Interface Filter
-
- All Superinterfaces:
Command
- All Known Implementing Classes:
DispatchLookupCommand
,LookupCommand
,PathInfoMapper
,RequestParameterMapper
,ServletPathMapper
public interface Filter extends Command
A
Filter
is a specializedCommand
that also expects theChain
that 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 subsequentCommand
whoseexecute()
method was called. The owningChain
must call thepostprocess()
method of eachFilter
in aChain
in 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 subsequentCommand
via theexecute()
returningfalse
. AFilter
can 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) $
-
-
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 boolean
postprocess(Context context, java.lang.Exception exception)
Execute any cleanup activities, such as releasing resources that were acquired during theexecute()
method of thisFilter
instance.
-
-
-
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 thisFilter
instance.- Parameters:
context
- TheContext
to be processed by thisFilter
exception
- TheException
(if any) that was thrown by the lastCommand
that was executed; otherwisenull
- Returns:
- If a non-null
exception
was "handled" by this method (and therefore need not be rethrown), returntrue
; otherwise returnfalse
- Throws:
java.lang.IllegalArgumentException
- ifcontext
isnull
-
-