Sun Java System Web Server 6.1 SP9 NSAPI Programmer's Guide

Changes in Function Flow

There are times when the function flow changes from the normal request-handling process. This happens during internal redirects, restarts, and URI translation functions.

Internal Redirects

An example of an internal redirect is a servlet include or forward. In this case, because there is no exposed NSAPI function to handle an internal redirect, when an internal redirect occurs, the request structure is copied into rq->orig_rq. For more information on the request data structure, seeRequest


A restart occurs when a REQ_RESTART is returned from a PathCheck or Service function. For example, when a CGI is redirected using a relative path.

On a restart, much of the request is cleared. Some elements of the HTTP request (rq->reqpb), the server’s “working” variables (rq->vars), and response headers (rq->srvhdrs) are cleared. The method, protocol, and clf-request variables from rq->reqpb are saved. The saved variables are put back into the data structure. The new URI is inserted (and if there is a query string in the new URI, that too is inserted) into rq->reqpb. The parameter rq->rq_attr.req_restarted is set to 1. For more information on the request data structure, seeRequest.

URI Translation

At times it is necessary to find the physical path for a URI without actually running a request. The function request_translate_uri does this. A new request structure is created and run through the AuthTrans and NameTrans stages to get the physical path. Thereafter, the new request is freed.