Netscape Server Application Programming Interface (NSAPI) is a set of C functions for implementing extensions to the server. These extensions are known as server plugins.
Using NSAPI you can write plugins to extend the functionality of Sun Java System Web Server. An NSAPI plugin defines one or more Server Application Functions (SAFs). You can develop SAFs for implementing custom authorization, custom logging, and for other ways of modifying how Sun Java System Web Server handles requests. For more information, see the Sun Java System Web Server 6.1 SP10 NSAPI Programmer’s Guide.
The obj.conf file contains instructions known as directives that instructs the server how to process requests received from clients. Each instruction is processed either during server initialization or during a particular stage of the request-handling process. Each instruction invokes an SAF.
For example, the following instruction is invoked when the request method is GET and the requested resource is of type text/html. This instruction calls the append-trailer function with a trailer argument of <H4><font color=green>Served by 6.1</font></H4>. The append-trailer function simply returns the requested resource to the client and appends the given trailer to it.
Service method=GET type="text/html" fn=append-trailer trailer="<H4> <font color=green>Served by 6.1</font></H4>" |
Sun Java System Web Server 6.1 comes with a set of predefined SAFs. It also comes with a library of NSAPI functions for developing your own SAFs to modify the way the server handles requests. For more information about predefined SAFs, see the Sun Java System Web Server 6.1 SP10 Administrator’s Configuration File Reference. For more information about custom SAFs, see the Sun Java System Web Server 6.1 SP10 NSAPI Programmer’s Guide.
The file obj.conf is essential for the operation of the server. If it does not exist, the server cannot work, because it has no instructions to handle requests.
When defining new SAFs, include the header function nsapi.h (which is in server_root/plugins/include) to provide access to all NSAPI functions.
To load new NSAPI plugins containing customized SAFs into the server, add an Init directive to magnus.conf to load the shared library file that defines the new SAFs. This directive must call the load-modules function. This function takes the following arguments:
shlib: The shared library to load.
funcs: The functions to be made available to the server.
See the Sun Java System Web Server 6.1 SP10 NSAPI Programmer’s Guide for more information about the following topics:
Directives in obj.conf and how the server handles requests
NSAPI functions available for writing custom SAFs
Writing custom SAFs
Loading custom SAFs into Sun Java System Web Server by adding an Init directive to magnus.conf that calls load-modules
For more information about the predefined SAFs that are included with Sun Java System Web Server, see the Sun Java System Web Server 6.1 SP10 Administrator’s Configuration File Reference.