mod_python.servlet

Overview

If mod_python’s publisher handler is a functional view of the web, the servlet handler is an object oriented view of the web. It is inspired by WebWare (http://webware.sourceforge.net).

I programmed with Webware for many projects. I loved the object oriented view of the web it promoted and found it to be a very productive tool to quickly prototype web applications. However, I found it lacking in a number of ways: 1) it has its own server process that needs to be started and managed, this is in addition to apache or another web server; 2) its class hierarchy is rather deep: there are five classes, inclusive, in the hierarchy between the base class and the class that represents an HTML page (there are only two in Mod_python Servlets); 3) even though a web server like apache manages processes and/or threads, WebWare has its own extensive thread management system which adds complexity to an overall web application; 4) WebWare promotes a comprehensive buy-in to their framework that, personally, I found unwieldy.

In short, I found WebWare too “big” for my needs and started looking for something more streamlined. I couldn’t find it.

Since I never intended on using a web server other than apache, it made sense to give mod_python a closer look than I had before. It was immediately clear that process/thread management came “free” by using an apache handler. The publisher handler is clearly a powerful tool, but I missed the OO view of WebWare. I looked at mod_python handlers that are available in the opensource community, but found most required a buy-in to their framework and/or content management system.

At some point I realized it would be VERY easy to implement the best features of WebWare as a mod_python handler without the bloat and management burdens of other systems. Best of all, it would be easy to reuse many features of mod_python without re-inventing the wheel (Session, Cookie, FieldStorage, etc.)

Installation

Thomas Baumann provides a RPM-Package for openpkg. The installation is easy:

  1. Install Openpkg environment
  2. Install Apache2, python, mod_python, and mod_python-servlet
  3. Make sure your httpd.conf contains following lines
AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "/openpkg/share/apache2/manual$1"
<Directory "/openpkg/share/apache2/manual">
    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all

    <Files *.html>
        SetHandler type-map
    </Files>

    SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1
    RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2
</Directory>
LoadModule python_module /openpkg/libexec/apache2/mod_python.so

<Directory /openpkg/share/apache2/manual/mod/mod_python.servlet>
   SetHandler mod_python
   PythonHandler mod_python.servlet
   PythonDebug on
</Directory>

 
wissen/gpl/apache/mod_python-servlet.txt · Zuletzt geändert: 05.09.2010 20:31
 
Recent changes RSS feed Donate Valid XHTML 1.0 Valid CSS Recent cached RSS feed cacert-signed web site: inhalt.serviert.de