<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw='http://wellformedweb.org/CommentAPI/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rl='http://www.purl.org/RESTLog/'>
  <channel>
    <title>Bulu</title>
    <link>http://wellformedweb.org/news/6</link>
    <description>
&lt;p&gt;&lt;a href="http://wellformedweb.org/story/2"&gt;Bulu&lt;/a&gt;, 
the server-side code for RESTLog, is now available. This is a Python script 
released under the &lt;a href="http://opensource.org/licenses/mit-license.php"&gt;MIT license&lt;/a&gt; 
that I have tested under Apache on Windows and Linux. It implements the interface described in 
&lt;a href="http://wellformedweb.org/news/5"&gt;The RESTLog Interface&lt;/a&gt;.
Note that it is not very useful without the client, which I will be publishing in a few days. 
I am making it available now as reference material for the descriptions of its operation.&lt;/p&gt;
&lt;p&gt; Before diving into the description of Bulu.cgi you may want to
take a look at the &lt;a href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html"&gt;CGI Specification&lt;/a&gt;
if you are unfarmiliar with how information is passed from the 
web server to a CGI application.
By the description of the interface for RESTLog, particularly the table
&lt;a href="http://wellformedweb.org/news/5#RESTLogInterface"&gt;that summarizes it&lt;/a&gt;,
incoming requests need to be dispatched based on URL, Verb and Type. (Note that when I
refer to Type I am talking about the abbreviated types in 
&lt;a href="http://wellformedweb.org/news/5#TypeMappings"&gt;Type Mappings Table&lt;/a&gt;.) The URL can
be that of the CGI script alone or it can be the name of the CGI script
with a path extension of the &lt;i&gt;itemID&lt;/i&gt;. Inside a CGI script the path extension
information is passed in via the PATH_INFO environment variable. Verb can be one of the standard
HTTP verbs GET, PUT, POST and DELETE and this is passed in via the REQUEST_METHOD
environment variable. Lastly the Type can be selected via 
&lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html#sec12"&gt;content negotiation&lt;/a&gt; or 
set by a query string. That's a lot of information to consider when dispatching requests so 
in RESTLog it is broken down into two phases. For the first phase requests are segregated
based on the URI they pertain to. Requests for the base URL &lt;code&gt;Bulu.cgi&lt;/code&gt; are passed to the 
class RootDispatch to be handled. Requests for the item URL &lt;code&gt;Bulu.cgi/&lt;i&gt;itemID&lt;/i&gt;&lt;/code&gt; 
are passed to the ItemDispatch class.&lt;/p&gt;
&lt;p&gt;Both RootDispatch and ItemDispatch derive from the same base class &lt;code&gt;BaseHttpDispatch&lt;/code&gt;
which has a single member function, &lt;code&gt;dispatch(self, verb, mime_type)&lt;/code&gt; which dispatches
requests based on the Verb and Type of the message. The dispatching is done by introspection (aka reflection
for those familiar with .Net nomenclature) where the dispatch function looks for 
a member function of the class that has the name Verb_Type. If a match isn't found
then it looks for the function with the name Verb. If none of those exist then an 
error code is returned. For example, if you POST an XML document to Bulu.cgi
then RootDispatch will be instanced and when BaseHttpDispatch.dispatch is called it will
first look for RootDispatch.POST_xml and if it fails to find that it will look
for the member function RootDispatch.POST. In Bulu.cgi RootDispatch implements POST_xml
and it is this function that is called when the client creates a new story by POSTing
the item as XML to the URL &lt;code&gt;Bulu.cgi&lt;/code&gt;.

&lt;/p&gt;
&lt;p&gt;Tomorrow I will cover the simplistic templating mechanisms that RESTLog employs 
to format the content.&lt;/p&gt;


</description>
    <dc:creator>BitWorking, Inc</dc:creator>
   <item>
      <title>Bulu</title>
      <link>http://wellformedweb.org/news/6#X1</link>
      <description>
		&lt;p&gt;nama saya adalah hakimi saya bayak bulu&lt;br /&gt;
saya anak ke 1000&lt;/p&gt;

 
      </description>

      <dc:date>2004-03-01T21:26:24-05:00</dc:date>      
   </item>
  </channel>
</rss>



