Using NSAPI, you can write plug-ins to extend the functionality of Web Server. An NSAPI plug-in 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 7.0 NSAPI Developer’s Guide.
The file obj.conf contains instructions (known as directives) that tell the server how to process requests received from clients. Each instruction is enacted either during server initialization or during a particular stage of the request-handling process. Each instruction invokes a 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 7.0</font></H4>. The append-trailer function simply returns the requested resource to the client, in this case an HTML file, and appends the given trailer to it.
Service method=GET type="text/html" fn=append-trailer trailer= "<H4><font color=green>Served by 7.0</font></H4>"
Web Server has a set of predefined SAFs. It also has 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 7.0 Administrator’s Configuration File Reference . For more information about custom SAFs, see the Sun Java System Web Server 7.0 NSAPI Developer’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 nowhere to look for instructions on how to handle requests.
To load new NSAPI plug-ins 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, which 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 7.0 NSAPI Developer’s Guide for more information about the following topics:
Directives in obj.conf and how they determine 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 Web Server, see the Sun Java System Web Server 7.0 Administrator’s Configuration File Reference.