Overview of NSAPI

                                                                                                                                                                                                                                                                                                                                      Back to [Book]     [Topic]

Overview of NSAPI

The NSAPI is an extension that enables you to extend or customize the core functionality of Sun Java System Web Server to provide a scalable, efficient mechanism for building interfaces between the HTTP server and back-end applications.

The NSAPI provides solutions to solve performance and efficiency problems common to installations that make liberal use of Common Gateway Interface (CGI ) functionality. CGI is common across most HTTP server implementations for running external programs, or gateways, between the information server and external applications.

The following topics are discussed:

HTTP Request-Response Process

This sections provides the logical breakdown of the HTTP request-response process.

After the client sends its request to a server, it is helpful to define a set of logical steps which the server must perform before a response is sent.

The following steps are performed in the normal response process:

  • Authorization translation
  • Name translation
  • Path checks
  • Object type
  • Respond to request
  • Log the transaction

If at any time one of these steps fail, another step must be performed to handle the error and inform the client about what happened.

About Server Application Function

Server Application Functions (SAFs) are used to perform the steps to generate a HTTP request-response. These functions take the request, and server configuration database as input, and return a response to the client as output. The set of functions which are applied are determined by the inputs.

Server application functions have a particular class, where the class corresponds to the request-response step it helps implement. There is an additional class of application function, the initialization function, which is executed upon server startup and performs static data initialization for the various server modules.

Server application functions have a single class and are not informed by the server which class they are being used for. The server keeps an internal table of available functions, and maps these function pointers to unique character strings which identify them. By using this string in the configuration database, a function can be called to carry out one of the above steps.

You can create custom Server Application Functions (SAFs). Creation of SAFs allow you to modify or extend the Sun Java System Web Server's built-in functionality. For example, you can modify the server to handle user authorization in a special way or generate dynamic HTML pages based on information in a database.

For more information about how to create a custom server application function, see Creating Custom Server Application Functions.

About Parameter Block

The parameter block is the fundamental data structure within the server code. The parameter block, or pblock, is a hash table keyed on the name string, which maps these name strings onto their value character strings.

For more information about the parameter block, see pblock Data Structure.

Passing Parameters to SAF

All server application functions have the following syntax:

int function(pblock *pb, Session *sn, Request *rq);

Where, pb is the parameter block with the parameters given by the site administrator for this function invocation. This parameter should be considered read-only, and any data modification should be performed on copies of the data. Doing otherwise is unsafe in threaded server architectures, and yields unpredictable results in multi-process server architectures.

Labels

java java Delete
server server Delete
sun sun Delete
webserver webserver Delete
system system Delete
webtier webtier Delete
guide guide Delete
webserver70 webserver70 Delete
sunjava sunjava Delete
nsapidevelopersguide nsapidevelopersguide Delete
developers developers Delete
web web Delete
+nsapiguide +nsapiguide Delete
nsapiguide nsapiguide Delete
developersguide developersguide Delete
nsapi nsapi Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact