Sun Java System Web Server 6.1 SP6 NSAPI Programmer's Guide

Write the Source Code

Write your custom SAFs using NSAPI functions. For a summary of some of the most commonly used NSAPI functions, see Overview of NSAPI C Functions available routines, see Chapter 7, NSAPI Function Reference

For examples of custom SAFs, see nsapi/examples/ in the server root directory, and also seeChapter 5, Examples of Custom SAFs and Filters

The signature for all SAFs is:

int function(pblock *pb, Session *sn, Request *rq);

For more details on the parameters, seeSAF Parameters

The Sun Java System Web Server runs as a multi-threaded single process. On UNIX platforms there are actually two processes (a parent and a child), for historical reasons. The parent process performs some initialization and forks the child process. The child process performs further initialization and handles all of the HTTP requests.

Keep the following in mind when writing your SAF: