WebStack

docs/Webware/NOTES.txt

103:0915c78d3795
2004-04-24 paulb [project @ 2004-04-24 16:59:49 by paulb] Updated documentation slightly for cookies.
     1 Webware's CGI adapter:
     2 
     3 Copy the Webware/WebKit/Adapters/WebKit.cgi file to your CGI directory (eg.
     4 /home/httpd/cgi-bin), then add a line like this to httpd.conf:
     5 
     6 ScriptAlias /webkit "/home/httpd/cgi-bin/WebKit.cgi"
     7 
     8 --------
     9 
    10 Authentication/authorisation in Webware:
    11 
    12 Since Webware provides some kind of CGI emulation environment, the actual HTTP
    13 headers involved with authentication/authorisation are not available to the
    14 WebStack transaction. Therefore, WebStack depends on Webware having access to
    15 the REMOTE_USER environment variable set by the Web server, and with Apache,
    16 this variable is only ever set when Apache itself has performed
    17 authentication. Whilst applications can send the "WWW-Authenticate" header to
    18 HTTP clients, unless Apache has been instructed to process the resulting
    19 username/password information, the REMOTE_USER will apparently remain
    20 undefined.
    21 
    22 Consequently, it is recommended that the following kind of definition is added
    23 to httpd.conf (for Apache) in order to give applications access to
    24 username/password details:
    25 
    26 <Location "/webkit/auth">
    27     AuthType Basic
    28     AuthName "AuthResource"
    29     AuthUserFile /usr/local/apache2/conf/users
    30     require valid-user
    31 </Location>
    32 
    33 The details of the application's deployment, including the exact pathname of
    34 the users file and the appropriate access policy, must obviously be defined
    35 according to the actual application concerned.
    36 
    37 Note that the above example will only apply authentication to either a
    38 specific context (for Webware releases beyond 0.8.1) and only to a specific
    39 "region" of possible URLs (for Webware 0.8.1 and earlier).
    40 
    41 --------
    42 
    43 For Webware releases beyond 0.8.1:
    44 
    45 WebStack applications are supported as contexts within WebKit, meaning that a
    46 certain prefix in the URL determines whether an application is sent a
    47 particular request.
    48 
    49 Each context must be defined in the Webware/WebKit/Configs/Application.config
    50 file within the 'Contexts' dictionary entry; for example:
    51 
    52 'simple': '/home/paulb/Software/Python/WebStack/examples/Webware/SimpleContext',
    53 
    54 Note that the path to the context directory must be absolute, although the
    55 context directory may reside within WebKit itself such that the path may then
    56 make use of the special %(WebKitPath)s substitution.
    57 
    58 Note also that the name of the context (eg. 'simple') must not be the same as
    59 the name of any other package used within the application (and possibly any
    60 other applications in the application server), with the only reasonable
    61 exception being the context package name itself (eg. 'SimpleContext').
    62 Otherwise, the existing package will become overridden by the contents of the
    63 context itself.  Therefore, given that the Simple package is used to hold the
    64 actual application code, it is not wise to use 'Simple' as the context name.
    65 
    66 Running the application server:
    67 
    68 Change into the WebKit directory within Webware. Then, specifying the
    69 appropriate PYTHONPATH, invoke the application server. For example:
    70 
    71 PYTHONPATH=../../../WebStack:../../../WebStack/examples/Common ./AppServer
    72 
    73 The WebStack package must reside on the PYTHONPATH, along with the package
    74 containing the application itself.
    75 
    76 --------
    77 
    78 For Webware 0.8.1 or earlier:
    79 
    80 Support for WebStack applications is provided by a Webware plug-in which
    81 associates Webware resources having certain suffixes with certain WebStack
    82 applications, regardless of the context within which a resource appears. In
    83 order to make use of such a scheme, a WebStack application would have its
    84 resources residing in an arbitrary URL "hierarchy", but with each resource
    85 having the special suffix to indicate that it belongs to that application.
    86 
    87 In the case of an application whose chosen suffix is ".xyz", it would be
    88 possible, for example, to define resources residing at the following URL
    89 paths:
    90 
    91   tasks/my-tasks.xyz
    92   tasks/outstanding/urgent.xyz
    93   agenda/today.xyz
    94 
    95 This is somewhat counter-intuitive to typical Webware concepts, and it is
    96 recommended that Webware releases beyond 0.8.1 are used together with the
    97 appropriate WebStack context mechanisms instead of using this plug-in scheme.
    98 
    99 In order to support such behaviour, the patches in the
   100 WebStack/patches/Webware/WebKit directory must be applied to WebKit:
   101 
   102 cd Webware/WebKit
   103 patch -p0 < ../../WebStack/patches/Webware/WebKit/Application.py-0.8.1.diff
   104 patch -p0 < ../../WebStack/patches/Webware/WebKit/HTTPRequest.py-0.8.1.diff
   105 
   106 Each plug-in, representing a WebStack application, should be visible in the
   107 Webware root directory. A symbolic link can be used to make each example
   108 appear; the Simple application being installed as follows:
   109 
   110 cd Webware
   111 ln -s ../WebStack/examples/Webware/SimpleApp
   112 
   113 Running the application server:
   114 
   115 Change into the WebKit directory within Webware. Then, specifying the
   116 appropriate PYTHONPATH, invoke the application server. For example:
   117 
   118 PYTHONPATH=../../WebStack:../../WebStack/examples/Common ./AppServer
   119 
   120 The WebStack package must reside on the PYTHONPATH, along with the package
   121 containing the application itself.