WebStack

README.txt

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