Save This Page
Home » commons-chain-1.2-src » org.apache.commons » chain » [javadoc | source]
org.apache.commons.chain
public interface: Filter [javadoc | source]

All Implemented Interfaces:
    Command

All Known Implementing Classes:
    DelegatingFilter, ExceptionFilter, PathInfoMapper, NonDelegatingFilter, RequestParameterMapper, LookupCommand, DispatchLookupCommand, ServletPathMapper

A Filter is a specialized Command that also expects the Chain that is executing it to call the postprocess() method if it called the execute() method. This promise must be fulfilled in spite of any possible exceptions thrown by the execute() method of this Command , or any subsequent Command whose execute() method was called. The owning Chain must call the postprocess() method of each Filter in a Chain in reverse order of the invocation of their execute() methods.

The most common use case for a Filter , as opposed to a Command , 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 subsequent Command via the execute() returning false. A Filter can reliably release such resources in the postprocess() method, which is guaranteed to be called by the owning Chain .

Method from org.apache.commons.chain.Filter Summary:
postprocess
Method from org.apache.commons.chain.Filter Detail:
 public boolean postprocess(Context context,
    Exception exception)

    Execute any cleanup activities, such as releasing resources that were acquired during the execute() method of this Filter instance.