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 and mod_python reliability around fields from
38 request bodies.
39 Provided stream and environment parameterisation in the CGI adapter.
40 Added LoginRedirect and Login examples.
41
42 Changes Since WebStack 0.2
43 --------------------------
44
45 Added better header support for Webware (suggested by Ian Bicking).
46 Introduced CGI and Java Servlet support (the latter is currently
47 broken/unfinished).
48 Introduced support for cookies.
49
50 Future Work
51 -----------
52
53 Things to consider for future releases: higher-level authentication support,
54 improved cookie handling, redirects, session interfaces, and much better
55 documentation.
56
57 Field access needs testing, especially for anything using the cgi.FieldStorage
58 class - Webware and Twisted certainly need reviewing. The acquisition of
59 fields from specific sources should be made more strict - some frameworks (eg.
60 mod_python) provide path fields in the body fields dictionary.
61
62 Cookie objects need defining strictly, especially since the standard library
63 Cookie object behaves differently to mod_python (and possibly Webware) Cookie
64 objects. Moreover, the set_cookie_value method needs to provide access to the
65 usual cookie parameters as supported by the frameworks.
66
67 Java Servlet API Notes
68 ----------------------
69
70 Using JythonServlet:
71
72 mkdir SimpleApp
73 mkdir SimpleApp/WEB-INF
74 mkdir SimpleApp/WEB-INF/classes
75 mkdir SimpleApp/WEB-INF/jython
76 mkdir SimpleApp/WEB-INF/lib
77 cp ${JYTHON_HOME}/jython.jar SimpleApp/WEB-INF/lib
78 cp -R ${WEBSTACK_HOME}/WebStack SimpleApp/WEB-INF/jython
79 cp -R ${WEBSTACK_HOME}/examples/Common/Simple SimpleApp/WEB-INF/jython
80 cp ${WEBSTACK_HOME}/examples/JavaServlet/SimpleApp.py SimpleApp
81 cp ${WEBSTACK_HOME}/examples/JavaServlet/web.xml SimpleApp/WEB-INF
82 mv SimpleApp ${CATALINA_HOME}/webapps
83
84 Unfortunately, PyServlet doesn't manage to find various modules in packages:
85
86 javax.servlet.ServletException: Could not create Jython servletTraceback (innermost last):
87 File "/data/home/paulb/Software/Java/jakarta-tomcat-4.1.27/webapps/SimpleApp/SimpleApp.py", line 3, in ?
88 ImportError: cannot import name JavaServlet
89
90 The same modules can be imported in interactive Jython.