All data sent to the server, such as the result of an HTML form or sent from the server, such as the output of a JSP page is passed through a set of filters known as a filter stack. The server creates a separate filter stack for each connection. While processing a request, individual filters can be inserted into and removed from the stack.
Different types of filters occupy different positions within a filter stack. Filters that deal with application-level content, such as filters that translates a page from XHTML to HTML, occupy a higher position than filters that deal with protocol-level issues, such as filters that format HTTP responses. When two or more filters are defined to occupy the same position in the filter stack, filters that were inserted later will appear higher than filters that were inserted earlier.
Filters positioned higher in the filter stack are given an earlier opportunity to process outgoing data. Filters positioned lower in the stack are given an earlier opportunity to process incoming data. For example, in the following figure, the xml-to-xhtml filter is given an earlier opportunity to process outgoing data than the xhtml-to-html filter.
When you create a filter with the filter_create function, you specify what position your filter should occupy in the stack. You can also use the init-filter-order Init SAF to control the position of specific filters within filter stacks. For example, init-filter-order can be used to ensure that a filter that converts outgoing XML to XHTML is inserted above a filter that converts outgoing XHTML to HTML.
For more information, see filter_create