Sun Java System Web Proxy Server 4.0.11 NSAPI Developer's Guide

More Complex Service Example

The send-images function is a custom SAF that replaces the doit.cgi demonstration available on the iPlanet home pages. When a file is accessed as /dir1/dir2/something.picgroup, the send-images function checks whether the file is being accessed by a Mozilla/1.1 browser. If the file is not being accessed, the function sends a short error message. The file something.picgroup contains a list of lines, each of which specifies a file name followed by a content-type, for example, one.gif image/gif.

To load the shared object containing your function, add the following line at the beginning of the obj.conf file:

Init fn=load-modules shlib=yourlibrary funcs=send-images

Also, add the following line to the mime.types file:

type=magnus-internal/picgroup exts=picgroup

To execute the custom SAF during the request-response process for an object, add the following line to that object in the obj.conf file. send-images takes an optional parameter, delay, which is not used for this example.

Service method=(GET|HEAD) type=magnus-internal/picgroup fn=send-images


The source code is located in service.c in the plugins/nsapi/examples subdirectory within the server root directory.