1 Introduction
2 ------------
3
4 WebStack is a package which provides a common API for Python Web applications,
5 regardless of the underlying server or framework environment. It should be
6 possible with WebStack to design and implement an application and to choose a
7 deployment environment, without having to go back and rewrite large parts of
8 that application to work in the chosen environment or in other environments
9 (should the deployment requirements change after the application has been
10 written).
11
12 Framework Support
13 -----------------
14
15 Currently, BaseHTTPRequestHandler (via BaseHTTPServer in the standard library),
16 mod_python, Twisted and Webware are supported. Each framework has its own set of
17 strengths and weaknesses, but the idea is that deployment concerns can be
18 considered separately from the implementation of application functionality.
19 Consult the NOTES.txt files in each framework's subdirectory of the docs
20 directory for some notes on how applications may be run in each environment.
21
22 Tested Frameworks
23 -----------------
24
25 BaseHTTPRequestHandler Python 2.2.2
26 mod_python 3.0.3 (3.1.3 for cookie support)
27 Twisted 1.0.5
28 Webware 0.8.1, CVS (2004-02-06)
29
30 Future Work
31 -----------
32
33 Things to consider for future releases: higher-level authentication support,
34 cookie handling, redirects, session interfaces, and much better documentation.
35
36 Field access needs testing, especially for anything using the cgi.FieldStorage
37 class - Webware and Twisted certainly need reviewing. The acquisition of
38 fields from specific sources should be made more strict - some frameworks (eg.
39 mod_python) provide path fields in the body fields dictionary.
40
41 Cookie objects need defining strictly, especially since the standard library
42 Cookie object behaves differently to mod_python (and possibly Webware) Cookie
43 objects.
44
45 Java Servlet API Notes
46 ----------------------
47
48 Using JythonServlet:
49
50 mkdir SimpleApp
51 mkdir SimpleApp/WEB-INF
52 mkdir SimpleApp/WEB-INF/classes
53 mkdir SimpleApp/WEB-INF/jython
54 mkdir SimpleApp/WEB-INF/lib
55 cp ${JYTHON_HOME}/jython.jar SimpleApp/WEB-INF/lib
56 cp -R ${WEBSTACK_HOME}/WebStack SimpleApp/WEB-INF/jython
57 cp -R ${WEBSTACK_HOME}/examples/Common/Simple SimpleApp/WEB-INF/jython
58 cp ${WEBSTACK_HOME}/examples/JavaServlet/SimpleApp.py SimpleApp
59 cp ${WEBSTACK_HOME}/examples/JavaServlet/web.xml SimpleApp/WEB-INF
60 mv SimpleApp ${CATALINA_HOME}/webapps
61
62 Unfortunately, PyServlet doesn't manage to find various modules in packages:
63
64 javax.servlet.ServletException: Could not create Jython servletTraceback (innermost last):
65 File "/data/home/paulb/Software/Java/jakarta-tomcat-4.1.27/webapps/SimpleApp/SimpleApp.py", line 3, in ?
66 ImportError: cannot import name JavaServlet
67
68 The same modules can be imported in interactive Jython.