AppWeb provides an open architecture to create URL handlers that process HTTP requests. Different content is serviced by different handlers. For example, the cgiHandler processes CGI requests while the copyHandler processes requests for static HTML pages and graphics.

AppWeb handlers are built upon the AppWeb loadable module interface and may be dynamically loaded and configured via the AppWeb configuration file. The configuration file defines the handlers to use and the order in which they are applied to a given request. While one handler ultimately handles the request and responds to the client, several handlers may inspect and perhaps modify the request before passing the request on to later handlers. 

Handler Processing

The following is an example set of AppWeb configuration file directives that loads various modules and then defines the handlers to be used when processing client requests. AppWeb actually defines many more handlers and modules.

LoadModule auth lib/libauthModule
LoadModule ejs lib/libejsModule
LoadModule esp lib/libespHandler
LoadModule static lib/libcopyHandler

AddHandler authHandler
AddHandler espHandler .esp .asp
AddHandler copyHandler

Note that the order of loading modules is important. As the ESP module uses the services of the EJS module, the EJS module must be loaded prior to loading ESP.

The order of the AddHandler directives is also important. When a request is received from a client, the handlers specified in the configuration file will be matched against the request. If a handler does not specify an extension (as the authHandler and the copyHandler do not), then they will always match. If the request URL extension matches the extension for a handler, then that handler will be added to the list of handlers for this request. For example: the URL http://www.acme.com/myDoc.esp would match the ".esp" extension for the espHandler. The result is a list of handlers that will be applied to the request in the order they appear in the configuration file.

Handlers may be either terminal or non-terminal. A terminal hander is the last handler in the chain and is responsible for returning the actual content back to the client's browser. A non-terminal handler inspects and optionally modifies the request. It may abort the request.

The authHandler is an example of a non-terminal URL handler. It will assess if the user has sufficient authorization to access the given URL. If the user is authorized, then the authHandler will allow the request to propagate down to be processed by the next handler in the list. If the user is not authorized, the authHandler will terminate the request and send the appropriate error back to the client.

Please see the document Creating URL Handlers for programming information about the AppWeb handlers APIs.

© Mbedthis Software LLC, 2003-2204. All rights reserved. Mbedthis is a trademark of Mbedthis Software LLC.