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