The init-filter-order function controls the position of specific filters within the filter stacks. For example, you can use init-filter-order to ensure that a filter that converts outgoing XML to XHTML is inserted above a filter that converts outgoing XHTML to HTML.
This function is applicable in Init-class directives.
Filters that appear higher in the filter stack are given the first opportunity to process outgoing data, and filters that appear lower in the filter stack are given the first opportunity to process incoming data.
The appropriate position of a specific filter within the filter stack is defined by the filter developer. For example, filters that translate content from XML to HTML are placed higher in the filter stack than filters that compress data for transmission. Filter developers use the filter-create function to define the filter's position in the filter stack. You can use init-filter-order to override the position defined by the filter developer.
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. That is, the order of Input fn="insert-filter" and Output fn="insert-filter" directives in obj.conf becomes important.
For example, consider two filters, xhtml-to-html and xml-to-xhtml, which convert XHTML to HTML and XML to XHTML, respectively. As both these filters transform data from one format to another, they may be defined to occupy the same position in the filter stack. To transform XML documents to XHTML and then to HTML before sending the data to the client, Output fn="insert-filter" directives in obj.conf should appear in the following order:
Output fn="insert-filter" filter="xhtml-to-html" Output fn="insert-filter" filter="xml-to-xhtml"
In general, you should use the order of Input fn="insert-filter" and Output fn="insert-filter" directives in obj.conf to control the position of filters in the filter stack. init-filter-order should only be used to address specific filter interoperability problems.
The load-module function that creates the filters should be called before init-filter-order attempts to order them.
The following table describes the init-filter-order parameter.Table 5–3 init-filter-order Parameter
A comma-separated list of filters in the order they should appear within a filter stack, listed from highest to lowest
Init fn="init-filter-order" filters="xml-to-xhtml,xhtml-to-html,http-compression"