NSAPI
directory contains
examples of source code for Server Application Functions (SAFs) which
helps you get started with programming
your Sun Java System Web Server.
The NSAPI provides a
method of
interfacing directly with the server code as opposed to using a Java
virtual machine or external programs. It is very flexible, allowing you
to implement your own custom access control
techniques, translate custom format files into HTML or images, and
control every aspect of the server's operation.
nsapi Examples
A complete index of nsapi
examples is listed below:
|
auth.c
|
The AuthTrans example demonstrates
how to use your own custom methods to verify that
the user name and password that a remote client provides is accurate.
|
ntrans.c
|
The nsapi directory contains
source code for two example NameTrans functions:
■ explicit_pathinfo—Enables the use of explicit extra path information
in a URL.
■ https_redirect—Redirects the URL if the client is a particular
version of Mozilla.
|
pcheck.c
|
The PathCheck example demonstrates
how to
implement a custom SAF for performing path checks. It checks whether
the requesting host is on a list of allowed hosts.
|
|
otype.c
|
The ObjectType example
demonstrates how to
implement html2shtml, a custom SAF that instructs the server to treat a
.html file as a .shtml file if a .shtml version of the requested file
exists.
|
replace.c
|
The Replace example comprises of
an NSAPI
filter named example-replace, which examines outgoing data and
substitutes one string for another. This example shows how to create a
filter that intercepts and modifies outgoing data.
|
service.c
|
The two
Service() function examples are: simple and more complex.
■ Simple Service() Example
■ More Complex Service() Example
|
|
addlog.c
|
The AddLog example demonstrates
how to
implement brief-log, a custom SAF for logging three items of
information about a request: the IP address, the method, and the URI,
for example, 198.93.95.99 GET
/jocelyn/dogs/homesneeded.html.
|
qos.c
|
The code for the qos-handler
(AuthTrans) and qos-error (Error) SAFs is provided in case you want to
define your own SAFs for quality of service handling.
|
|
|