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
16 library), CGI, mod_python, Twisted and Webware are supported. Each framework
17 has its own set of strengths and weaknesses, but the idea is that deployment
18 concerns can be considered separately from the implementation of application
19 functionality. Consult the NOTES.txt files in each framework's subdirectory of
20 the docs directory for some notes on how applications may be run in each
21 environment.
22
23 Tested Frameworks
24 -----------------
25
26 BaseHTTPRequestHandler Python 2.2.2
27 CGI Apache 2.0.44
28 mod_python 3.0.3 (3.1.3 for cookie support)
29 Twisted 1.0.5
30 Webware 0.8.1, CVS (2004-02-06)
31
32 Changes Since WebStack 0.3
33 --------------------------
34
35 Added application definition of user identity, permitting alternative
36 authentication mechanisms.
37 Improved BaseHTTPRequestHandler reliability.
38 Added LoginRedirect and Login examples.
39
40 Changes Since WebStack 0.2
41 --------------------------
42
43 Added better header support for Webware (suggested by Ian Bicking).
44 Introduced CGI and Java Servlet support (the latter is currently
45 broken/unfinished).
46 Introduced support for cookies.
47
48 Future Work
49 -----------
50
51 Things to consider for future releases: higher-level authentication support,
52 improved cookie handling, redirects, session interfaces, and much better
53 documentation.
54
55 Field access needs testing, especially for anything using the cgi.FieldStorage
56 class - Webware and Twisted certainly need reviewing. The acquisition of
57 fields from specific sources should be made more strict - some frameworks (eg.
58 mod_python) provide path fields in the body fields dictionary.
59
60 Cookie objects need defining strictly, especially since the standard library
61 Cookie object behaves differently to mod_python (and possibly Webware) Cookie
62 objects. Moreover, the set_cookie_value method needs to provide access to the
63 usual cookie parameters as supported by the frameworks.
64
65 Java Servlet API Notes
66 ----------------------
67
68 Using JythonServlet:
69
70 mkdir SimpleApp
71 mkdir SimpleApp/WEB-INF
72 mkdir SimpleApp/WEB-INF/classes
73 mkdir SimpleApp/WEB-INF/jython
74 mkdir SimpleApp/WEB-INF/lib
75 cp ${JYTHON_HOME}/jython.jar SimpleApp/WEB-INF/lib
76 cp -R ${WEBSTACK_HOME}/WebStack SimpleApp/WEB-INF/jython
77 cp -R ${WEBSTACK_HOME}/examples/Common/Simple SimpleApp/WEB-INF/jython
78 cp ${WEBSTACK_HOME}/examples/JavaServlet/SimpleApp.py SimpleApp
79 cp ${WEBSTACK_HOME}/examples/JavaServlet/web.xml SimpleApp/WEB-INF
80 mv SimpleApp ${CATALINA_HOME}/webapps
81
82 Unfortunately, PyServlet doesn't manage to find various modules in packages:
83
84 javax.servlet.ServletException: Could not create Jython servletTraceback (innermost last):
85 File "/data/home/paulb/Software/Java/jakarta-tomcat-4.1.27/webapps/SimpleApp/SimpleApp.py", line 3, in ?
86 ImportError: cannot import name JavaServlet
87
88 The same modules can be imported in interactive Jython.