1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/resource-creation.html Sun Apr 24 15:43:10 2005 +0000
1.3 @@ -0,0 +1,82 @@
1.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.5 +<html xmlns="http://www.w3.org/1999/xhtml">
1.6 +<head>
1.7 + <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />
1.8 + <title>How Resources are Created</title>
1.9 + <meta name="generator"
1.10 + content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.11 + <link href="styles.css" rel="stylesheet" type="text/css" />
1.12 +</head>
1.13 +<body>
1.14 +<h1>How Resources are Created
1.15 +</h1>
1.16 +<p>In the <code>MyApplication</code>
1.17 +<a href="resources.html">example</a>,
1.18 +the only
1.19 +thing we need to
1.20 +consider is
1.21 +what our code does, not how objects are created from the <code>MyResource</code>
1.22 +class and how the <code>respond</code>
1.23 +method is invoked. However, the mechanisms behind all these things are
1.24 +not magic - the <a href="deploying.html">adapter
1.25 +code</a> is responsible for all of
1.26 +this. Let us
1.27 +turn the diagram of components on its side and investigate what happens
1.28 +when a request is sent to the application from a user:</p>
1.29 +<table class="layers"
1.30 + style="width: 80%; text-align: left; margin-left: auto; margin-right: auto;"
1.31 + border="0" cellpadding="5" cellspacing="0">
1.32 + <tbody>
1.33 + <tr>
1.34 + <th
1.35 + style="border-width: 1px 1px 0px; text-align: center; vertical-align: middle; background-color: rgb(192, 192, 192); width: 30%; border-top-style: solid; border-left-style: solid;">Server
1.36 +environment</th>
1.37 + <th
1.38 + style="border-width: 1px; text-align: center; vertical-align: middle; border-left-style: solid; border-top-style: solid; width: 30%; background-color: rgb(102, 203, 255);">Adapter
1.39 + </th>
1.40 + <th
1.41 + style="text-align: center; vertical-align: middle; border-top-style: solid; border-left-style: solid; border-right-style: solid; border-top-width: 1px; border-left-width: 1px; border-right-width: 1px; background-color: rgb(193, 255, 102); width: 40%;">Application
1.42 + </th>
1.43 + </tr>
1.44 + <tr>
1.45 + <td
1.46 + style="background-color: rgb(192, 192, 192); border-left-style: solid; border-left-width: 1px;"
1.47 + align="undefined" valign="undefined"><span class="method">The request
1.48 +is received and sent to
1.49 +the adapter... </span></td>
1.50 + <td
1.51 + style="background-color: rgb(102, 203, 255); border-left-style: solid; border-left-width: 1px;"
1.52 + align="undefined" valign="undefined"><span class="method">The adapter
1.53 +creates a resource object
1.54 +in the application... </span></td>
1.55 + <td
1.56 + style="background-color: rgb(193, 255, 102); border-left-style: solid; border-right-style: solid; border-left-width: 1px; border-right-width: 1px;"
1.57 + align="undefined" valign="undefined"><span class="method">A resource
1.58 +object is
1.59 +created and initialised. </span></td>
1.60 + </tr>
1.61 + <tr>
1.62 + <td
1.63 + style="background-color: rgb(192, 192, 192); border-left-style: solid; border-bottom-style: solid; border-left-width: 1px; border-right-width: 1px; border-bottom-width: 1px;"><br />
1.64 + </td>
1.65 + <td
1.66 + style="background-color: rgb(102, 203, 255); border-left-style: solid; border-bottom-style: solid; border-left-width: 1px; border-bottom-width: 1px;"
1.67 + align="undefined" valign="undefined"><span class="method">The adapter
1.68 +calls the <code>respond</code> method on the new resource...</span></td>
1.69 + <td
1.70 + style="background-color: rgb(193, 255, 102); border-left-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-width: 1px; border-right-width: 1px; border-bottom-width: 1px;"
1.71 + align="undefined" valign="undefined"><span class="method">The code
1.72 +within the resource's <code>respond</code> method is executed. </span></td>
1.73 + </tr>
1.74 + </tbody>
1.75 +</table>
1.76 +<p>In more
1.77 +complicated applications, there may
1.78 +be a
1.79 +need to create our own resource objects explicitly, but this is not
1.80 +particularly interesting to think about at this point - see <a
1.81 + href="paths-filesystem.html">"Treating the Path Like
1.82 +a Filesystem"</a> for a
1.83 +discussion of multiple resource objects.</p>
1.84 +</body>
1.85 +</html>