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 SP12 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 SP12 Administrator’s Configuration File Reference. For more information about custom SAFs, see the Sun Java System Web Server 6.1 SP12 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.
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 SP12 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
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 SP12 Administrator’s Configuration File Reference.