Filters differ from handlers in that more than one filter may be executed for a given request. Before a request is serviced, a matching filter chain is built and all all matching filters are then executed in turn as part of the request handling.
Each filter may modify (or even replace) both the request and response object or simply abort the request by not calling the next filter in the filter chain.
In ESXX, a filter is called with two parameters: the request object and a function that calls the next filter in the chain. The filter is supposed to return a response that will be sent to the client (optionally passing through the XSLT engine). That means that a filter may:
- Abort the request by not calling the next() function at all.
- Tweak the request by modifying the request object before calling the next() function.
- Tweak the response by modifying the result of the next() function.
Do have a look at an example to see how ESXX filters work.