All Output directives are executed when the server or a plugin first attempts to write entity body data from the client.
The Output stage allows you to select filters that will process outgoing data.
You can add NSAPI filters that process outcoming data by invoking the insert-filter SAF in the Output stage of the request-handling process. The Output directives are executed at most once per request.
You can define the appropriate position of a specific filter within the filter stack. For example, filters that translate content from XML to HTML are placed higher in the filter stack than filters that compress data for transmission. You can use the filter_create function to define the filter’s position in the filter stack, and the init-filter-order to override the defined position.
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.
The following Output-class functions are described in detail in this section:
content-rewrite rewrites the string in the document that is being sent to the client.
insert-filter adds a filter to the filter stack to process outgoing data.
match-browser matches specific strings in the User-Agent string supplied by the browser, and then modifies the behavior of Sun Java System Web Proxy Server based upon the results by setting values for specified variables.
remove-filter removes a filter from the filter stack.
set-variable enables you to change server settings based upon conditional information in a request, and to manipulate variables in parameter blocks by using specific commands.
The content-rewrite function rewrites the string in the document that is being sent to the client.
When a document is sent by the proxy server, the content-rewrite function is invoked if it has been configured and would replace the from string/url to destination string/url before sending the response to the client.
The patterns are nothing but strings which would be replaced in the outgoing document. The pattern can be either an url with absolute or relative links, or any text string like server name and so on.
Output fn="insert-filter" filter="content-rewrite" type="text/html" from="<sourcepattern>" to="<destpattern>"
The following table describes parameters for the content-rewrite function.
Table 5–89 content-rewrite parameters
Parameter |
Description |
---|---|
filter |
Specifies the name of the filter to be executed. |
type |
Indicates on what content-type this filter is applied. For example, text , html, and so on. |
Output fn="insert-filter" type="text/*" filter="content-rewrite" from="iPlanet" to="Sun ONE (now called) Sun Java System Web Proxy Server" |
Applicable in Output-class directives.
The insert-filter SAF is used to add a filter to the filter stack to process outgoing (server-to-client) data.
The order of Input fn="insert-filter" and Output fn="insert-filter" directives can be important.
Returns REQ_PROCEED if the specified filter was inserted successfully, or REQ_NOACTION if the specified filter was not inserted because it was not required. Any other return value indicates an error.
The following table describes parameters for the insert-filter function.
Table 5–90 insert-filter parameters
Parameter |
Description |
---|---|
filter |
Specifies the name of the filter to insert. |
bucket |
(Optional) Common to all obj.conf functions. |
Output fn="insert-filter" filter="http-compression" |
See match-browser.
Applicable in Input-, Output-, Service-, and Error-class directives.
The remove-filter SAF is used to remove a filter from the filter stack. If the filter has been inserted multiple times, only the topmost instance is removed. In general, it is not necessary to remove filters with remove-filter, as they will be removed automatically at the end of the request.
Returns REQ_PROCEED if the specified filter was removed successfully, or REQ_NOACTION if the specified filter was not part of the filter stack. Any other return value indicates an error.
The following table describes parameters for the remove-filter function.
Table 5–91 remove-filter parameters
Parameter |
Description |
---|---|
filter |
Specifies the name of the filter to remove. |
bucket |
(Optional) Common to all obj.conf functions. |
Output fn="remove-filter" filter="http-compression" |
Applicable in all stage directives. The set-variable SAF enables you to change server settings based upon conditional information in a request, and to manipulate variables in parameter blocks by using specific commands. See set-variable.