WebStack

docs/design.html

400:5b276bbcbbb5
2005-07-16 paulb [project @ 2005-07-16 20:32:38 by paulb] Changed virtual path info in sub-resources so that it may be an empty string.
     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     2 <html xmlns="http://www.w3.org/1999/xhtml">     3 <head>     4   <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />     5   <title>Application Design Considerations</title>     6   <meta name="generator"     7  content="amaya 8.1a, see http://www.w3.org/Amaya/" />     8   <link href="styles.css" rel="stylesheet" type="text/css" />     9 </head>    10 <body>    11 <h1>Application Design Considerations</h1>    12 <p>When writing an application, we    13 must try and cover the three activities mentioned in our overview of    14 what a simple resource looks like:</p>    15 <ol>    16   <li>Examine the transaction, decide what the user wants to do.</li>    17   <li>Perform some kind of action with the information supplied.</li>    18   <li>Produce some kind of response which tells the user what happened.</li>    19 </ol>    20 <p>We briefly covered the third activity in the <code>MyApplication</code>    21 example, but for a real, properly-behaved application, we need to visit    22 each activity in detail.</p>    23 <h2>Examine the Transaction</h2>    24 <p>In WebStack, the transaction is an object which is passed into a    25 resource when a user makes contact with an application. This    26 transaction object effectively tells us what it is the user wants to    27 do; it does so through a number of different pieces of information    28 including the request method, headers, parameters, cookies and sessions.</p>    29 <div class="WebStack">    30 <h3>WebStack API - The Transaction Object</h3>    31 <p>The transaction object appears as the first parameter in a    32 resource's&nbsp;<code>respond</code> method:</p>    33 <pre>class SomeResource:<br />    def respond(self, trans):<br />        [Here is where the code for the resource is written.]</pre>    34 <p>For full information about transaction objects, see the API    35 documentation for the&nbsp;<a    36  href="../apidocs/public/WebStack.Generic.Transaction-class.html"><code>WebStack.Generic.Transaction</code></a>    37 class.</p>    38 </div>    39 <p>Within this activity,&nbsp;certain&nbsp;topics&nbsp;are of interest:</p>    40 <ul>    41   <li><a href="paths.html">URLs and Paths</a></li>    42   <li><a href="methods.html">Request Methods</a></li>    43   <li><a href="parameters.html">Request Parameters and Uploads</a></li>    44 </ul>    45 <h2>Perform Actions</h2>    46 <p>Of all activities summarised above, this is the most vague because    47 the kinds of actions performed by applications will vary substantially    48 depending on what the application is supposed to do. Indeed, it is    49 within this activity that most applications will probably be integrated    50 with other systems - they may access databases or Web services, for    51 example.</p>    52 <p>WebStack does not mandate any particular style of integration with    53 other systems. It is generally recommended that developers use    54 whichever Python modules or packages they prefer and just to import    55 these into their applications. See&nbsp;<a href="integrating.html">"Integrating    56 with Other Systems"</a> for advice on this subject.</p>    57 <h2>Produce a Response</h2>    58 <p>This activity was briefly covered in&nbsp;the <code>MyApplication</code>    59 example, but for "real world" applications the following topics must be    60 understood in more detail:</p>    61 <ul>    62   <li><a href="responses.html">Responses and Presentation</a></li>    63   <li><a href="state.html">Cookies, Sessions, Users and Persistent    64 Information</a></li>    65 </ul>    66 </body>    67 </html>