1.1 --- a/docs/anatomy.html Fri Apr 08 22:33:56 2005 +0000
1.2 +++ b/docs/anatomy.html Fri Apr 08 23:09:33 2005 +0000
1.3 @@ -1,61 +1,58 @@
1.4 -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
1.5 +<?xml version="1.0" encoding="iso-8859-1"?>
1.6 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
1.7 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.8 <html xmlns="http://www.w3.org/1999/xhtml">
1.9 <head>
1.10 <title>Anatomy of a WebStack Application</title>
1.11 - <meta name="generator"
1.12 - content="amaya 8.1a, see http://www.w3.org/Amaya/">
1.13 - <link xmlns:xlink="http://www.w3.org/1999/xlink" href="styles.css"
1.14 - rel="stylesheet" type="text/css">
1.15 + <meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.16 + <link href="styles.css" rel="stylesheet" type="text/css" />
1.17 </head>
1.18 +
1.19 <body>
1.20 <h1>Anatomy of a WebStack Application</h1>
1.21 -<p>The simplest way to think of a Web application is as just some code
1.22 -which
1.23 -gets run every time an HTTP request arrives at a specific network
1.24 -address and
1.25 -which produces an HTTP response. Without WebStack, such code often
1.26 -needs to
1.27 -be tailored to the software which causes it to be run, but with
1.28 -WebStack you
1.29 +
1.30 +<p>The simplest way to think of a Web application is as just some code which
1.31 +gets run every time an HTTP request arrives at a specific network address and
1.32 +which produces an HTTP response. Without WebStack, such code often needs to
1.33 +be tailored to the software which causes it to be run, but with WebStack you
1.34 just need to do this:</p>
1.35 <ol>
1.36 - <li>Write some application code which uses the WebStack API - this
1.37 -code can be run within any of the supported environments.</li>
1.38 + <li>Write some application code which uses the WebStack API - this code can
1.39 + be run within any of the supported environments.</li>
1.40 <li>Write some simple adapter or "glue" code - this code makes the
1.41 -application work with each of the environments that you want to use and
1.42 -should be much smaller in size than the application code.</li>
1.43 + application work with each of the environments that you want to use and
1.44 + should be much smaller in size than the application code.</li>
1.45 </ol>
1.46 -<p>Most of the time, you need only to think about the first activity
1.47 -(writing
1.48 -against the WebStack API).<br>
1.49 +
1.50 +<p>Most of the time, you need only to think about the first activity (writing
1.51 +against the WebStack API).<br />
1.52 </p>
1.53 +
1.54 <h2>A Very Simple Example</h2>
1.55 -In the simplest case, you just need to produce a Python class which
1.56 -takes
1.57 +In the simplest case, you just need to produce a Python class which takes
1.58 this form:
1.59 -<pre>class MyResource:<br><br> "This is a resource - something which defines the behaviour of an application."<br><br> def respond(self, trans):<br> [Examine the transaction, decide what the user wants to do.]<br> [Perform some kind of action with the information supplied.]<br> [Produce some kind of response which tells the user what happened.]</pre>
1.60 -<p>The parts of the pseudo-code in the above text which aren't valid
1.61 -Python
1.62 -(ie. the bits in square brackets) will use various WebStack API calls
1.63 -to look
1.64 -at what the user specified in the request and to send information back
1.65 -to the
1.66 -user in the response.<br>
1.67 +<pre>class MyResource:<br /><br /> "This is a resource - something which defines the behaviour of an application."<br /><br /> def respond(self, trans):<br /> [Examine the transaction, decide what the user wants to do.]<br /> [Perform some kind of action with the information supplied.]<br /> [Produce some kind of response which tells the user what happened.]</pre>
1.68 +
1.69 +<p>The parts of the pseudo-code in the above text which aren't valid Python
1.70 +(ie. the bits in square brackets) will use various WebStack API calls to look
1.71 +at what the user specified in the request and to send information back to the
1.72 +user in the response.<br />
1.73 </p>
1.74 +
1.75 <p>WebStack applications consist of resource classes which contain the
1.76 -application code. In the above example, the only thing we need to
1.77 -consider is what our code does, not how resource objects are created
1.78 -and invoked (that is done in the adapter code). In more complicated
1.79 -applications, there may be a need to create our own resource objects
1.80 -explicitly, but this is not particularly interesting to think about at
1.81 -this point - see <a href="paths-filesystem.html">"Treating the Path
1.82 -Like a Filesystem"</a> for a discussion of multiple resource objects.<br>
1.83 +application code. In the above example, the only thing we need to consider is
1.84 +what our code does, not how resource objects are created and invoked (that is
1.85 +done in the adapter code). In more complicated applications, there may be a
1.86 +need to create our own resource objects explicitly, but this is not
1.87 +particularly interesting to think about at this point - see <a
1.88 +href="paths-filesystem.html">"Treating the Path Like a Filesystem"</a> for a
1.89 +discussion of multiple resource objects.<br />
1.90 </p>
1.91 +
1.92 <h2>Design Considerations</h2>
1.93 -<p>When writing an application, we must consider a number of factors
1.94 -which
1.95 -have an impact on the code (and other things) that we will need to
1.96 -provide as
1.97 +
1.98 +<p>When writing an application, we must consider a number of factors which
1.99 +have an impact on the code (and other things) that we will need to provide as
1.100 part of the finished product or service.</p>
1.101 <ul>
1.102 <li><a href="paths.html">URLs and Paths</a></li>