Python Manual User Manual

Page of 124
87
Servlet Framework
The HTTP servlet framework can be used to provide a window into your application. A number of pre-
defined servlets are provided or you can create your own. You can also create your own server objects
to map the servlets to appropriate parts of the URL namespace. Alternatively, a number of predefined
server objects can be used for common tasks such as serving up files from the filesystem, or provision
of RPC over HTTP services. Basic user authentication is implemented and clients can also be blocked
based on their address.
The major classes in the OSE C++ class library involved in providing this functionality are the
OTC_HttpDaemon
,
OTC_HttpServer
and
OTC_HttpServlet
classes, plus the various de-
rived servlet and server classes. The implementation of the HTTP servlet framework is based on the
event system and multiple HTTP requests can be handled concurrently.
Although the framework is quite powerful, you should still keep in mind that its main purpose is for
interacting with an application. If you are after a general purpose web server, you would probably be
better off using a product like Apache. If you need the appearance that the web site and application are
one, use the "
mod_proxy
" plugin for Apache to redirect only a portion of the URL namespace. This
actually has the added benefit that Apache can be used to setup a SSL connection with the client over
any insecure network, with communication between Apache and the application on the secure network
being normal HTTP.
Framework Overview
When a HTTP client makes a connection to the server process, a session manager is created to parse
any requests made by that client. For each request, an attempt is made to find a server object which
manages the part of the URL namespace that the request falls under. This server object is then asked