Sun Java System Web Server 7.0 NSAPI Developer's Guide

Output Example

This section describes an example NSAPI filter named example-replace, which examines outgoing data and substitutes one string for another. It shows how you can create a filter that intercepts and modifies outgoing data.

Installing the Output Example

To load the filter, add the following line in the Init section of the magnus.conf file:


Init fn="load-modules" 
     shlib=yourlibrary
     NativeThread="no"

To execute the filter during the request-response process for some object, add the following line to that object in the obj.conf file:


Output fn="insert-filter" 
       type="text/*" 
       filter="example-replace" 
       from="iPlanet" to="Sun ONE"
        

The source code for this example is in the replace.c file in the install_dir/samples/nsapi/ directory.