paulb@330 | 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
paulb@330 | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
paulb@330 | 3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
paulb@330 | 4 | <html xmlns="http://www.w3.org/1999/xhtml"> |
paulb@330 | 5 | <head> |
paulb@330 | 6 | <title>Writing Adapters</title> |
paulb@330 | 7 | <meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" /> |
paulb@330 | 8 | <link href="styles.css" rel="stylesheet" type="text/css" /> |
paulb@330 | 9 | </head> |
paulb@330 | 10 | |
paulb@330 | 11 | <body> |
paulb@330 | 12 | <h1>Writing Adapters</h1> |
paulb@330 | 13 | |
paulb@330 | 14 | <p>Depending on how "simple" the adapter code is allowed to be for a given |
paulb@330 | 15 | server environment (see the <a href="deploying.html">table</a> for a |
paulb@330 | 16 | summary), you will either need to write a small piece of code which |
paulb@330 | 17 | initialises and deploys your application, or to produce a more complicated |
paulb@330 | 18 | piece of code which satisfies some more demanding server requirements.</p> |
paulb@330 | 19 | |
paulb@330 | 20 | <h2>Simple Adapters - Using the deploy Function</h2> |
paulb@330 | 21 | |
paulb@330 | 22 | <p>When deploying an application, it is possible to use a one-shot deployment |
paulb@330 | 23 | function for BaseHTTPRequestServer, CGI, Twisted and WSGI. The |
paulb@330 | 24 | <code>deploy</code> function is called as follows:</p> |
paulb@330 | 25 | <pre>deploy(resource) |
paulb@330 | 26 | deploy(resource, authenticator) # where authenticators are used</pre> |
paulb@330 | 27 | |
paulb@330 | 28 | <p>For some frameworks, an address may be specified:</p> |
paulb@330 | 29 | <pre>deploy(resource, address=(host_string, port_integer)) |
paulb@330 | 30 | deploy(resource, authenticator, address=(host_string, port_integer))</pre> |
paulb@330 | 31 | |
paulb@330 | 32 | <p>Here is a summary of which frameworks require address information:</p> |
paulb@330 | 33 | |
paulb@330 | 34 | <table border="1" cellpadding="5" cellspacing="0"> |
paulb@330 | 35 | <tbody> |
paulb@330 | 36 | <tr> |
paulb@330 | 37 | <th>Framework</th> |
paulb@330 | 38 | <th>Address Information</th> |
paulb@330 | 39 | </tr> |
paulb@330 | 40 | <tr> |
paulb@330 | 41 | <td>BaseHTTPRequestHandler</td> |
paulb@330 | 42 | <td>Supported</td> |
paulb@330 | 43 | </tr> |
paulb@330 | 44 | <tr> |
paulb@330 | 45 | <td>CGI</td> |
paulb@330 | 46 | <td>Ignored</td> |
paulb@330 | 47 | </tr> |
paulb@330 | 48 | <tr> |
paulb@330 | 49 | <td>Twisted</td> |
paulb@330 | 50 | <td>Supported (<code>host_string</code> is ignored)</td> |
paulb@330 | 51 | </tr> |
paulb@330 | 52 | <tr> |
paulb@330 | 53 | <td>WSGI</td> |
paulb@330 | 54 | <td>Ignored</td> |
paulb@330 | 55 | </tr> |
paulb@330 | 56 | </tbody> |
paulb@330 | 57 | </table> |
paulb@330 | 58 | |
paulb@330 | 59 | <h2>Complicated Adapters - Providing Framework-Specific Objects</h2> |
paulb@330 | 60 | |
paulb@330 | 61 | <p>The remaining frameworks (Java Servlet, mod_python, Webware and Zope) do |
paulb@330 | 62 | not support the <code>deploy</code> function due to the way applications are |
paulb@330 | 63 | typically integrated into the various server mechanisms. In these cases, it |
paulb@330 | 64 | may be worth investigating the examples provided and using their adapter code |
paulb@330 | 65 | as a template for the code for your own applications.</p> |
paulb@330 | 66 | </body> |
paulb@330 | 67 | </html> |