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