Sun Java System Web Server 6.1 SP11 Programmer's Guide


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

Note –

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.

Note –

When defining new SAFs, include the header function nsapi.h (which is in server_root/plugins/include) to provide access to all NSAPI functions.

Installing NSAPI Plugins (SAFs)

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:

See the Sun Java System Web Server 6.1 SP11 NSAPI Programmer’s Guide for more information about the following topics: