GoAhead WebServer URL Handlers The GoAhead WebServer implements a flexible URL handler
where the semantics of a URL may be interpreted at run-time by multiple
URL handlers. URL handlers are given the URL and the option of accepting
it for processing. If a handler accepts the URL, no further
URL handlers will be called. A URL handler specifies a path prefix, a processing function and a order option. The
path prefix nominates the URLs of interest. Any URL that matches this URL prefix is
given to the handler for processing. A match is deemed to occur if
the URL exactly matches the prefix for the length of the prefix. If
more than one handler matches, the longest matching URL handler will be called
first and so-on in decreasing length order. For example, the following
all match the prefix "/my":
/myCar?model= ford
/myPath/model/ford
/my/car/model/ford
A URL handler may supply the empty URL prefix
"" and thus match all URLs. The order option enables a URL handler to
specify that it wishes to be processed first or last regardless of the URL
match. This is specified by the flagsparameter to the
websUrlHandlerDefine API call. If multiple
handlers may specify these flags, the order of evaluation for the handlers
specifiying the same flag is undefined. A URL handler is a C procedure according to the
following prototype:
int myHandler(webs_t wp, char_t *url, char_t *path,
char_t *query);
The url parameter contains the entire URL. The path parameter
holds the URL portion after the hostname and port number. The query
parameter holds any optional query. The URL handler must return 1 if it elects
to process the URL. Otherwise it should return 0 to indicate that a later URL
handler should process the URL. A URL handler may modify the settings of a request but
delay handling of the URL to another handler. The security handler is one
example of this. Request settings, form variables and URL details may be
modified by a handler to affect the processing by other handlers. See Also
Active Server Pages,
JavaScript,
GoForms,
websSecurityHandler,
websUrlHandlerDefine |