The plugins/nsapi/examples subdirectory within the server installation directory contains examples of source code for SAFs.
You can use the example.mak makefile in the same directory to compile the examples and create a library containing the functions in all of the example files.
To test an example, load the examples shared library into the Sun Java System Web Proxy Server by adding the following directive in the Init section of obj.conf:
Init fn=load-modules shlib=examples.so/dll funcs= function1,function2,function3 |
The funcs parameter specifies the functions to load from the shared library.
If the example uses an initialization function, specify the initialization function in the funcs argument to load-modules. Also, add an Init directive to call the initialization function.
For example, the PathCheck example implements the restrict-by-acf function, which is initialized by the acf-init function. The following directive loads both these functions:
Init fn=load-modules yourlibrary funcs=acf-init,restrict-by-acf
The following directive calls the acf-init function during server initialization:
Init fn=acf-init file=extra-arg
To invoke the new SAF at the appropriate step in the response handling process, add an appropriate directive in the object to which it applies, for example:
PathCheck fn=restrict-by-acf
After adding new Init directives to obj.conf, restart the Sun Java System Web Proxy Server to load the changes Init directives are only applied during server initialization.