<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
That was it. If you lived near by I'd buy you a beer. Thank you!
<div>
<div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 11pt; font-family: Calibri, sans-serif; ">
<font class="Apple-style-span" color="#808080"><b><br>
</b></font></div>
</span></span></div>
<br>
<div>
<div>On Oct 21, 2010, at 1:47 PM, Marco Giusti wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div>On Thu, Oct 21, 2010 at 01:17:36PM -0700, Eric Chamberlain wrote:<br>
<blockquote type="cite">I'm trying to add a single service to a virtual path like
<a href="http://localhost:8080/geospatial/geocoder/XMLRPC">http://localhost:8080/geospatial/geocoder/XMLRPC</a>.<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">Version info:<br>
</blockquote>
<blockquote type="cite">Twisted: 9.0<br>
</blockquote>
<blockquote type="cite">Python: 2.6<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">The following code does not work:<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">root = resource.Resource()<br>
</blockquote>
<blockquote type="cite">srv = XMLRPCGeocoder()<br>
</blockquote>
<blockquote type="cite">root.putChild("geospatial/geocoder/XMLRPC", srv)<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">When I attempt to access the service, twisted gives the following error:<br>
</blockquote>
<blockquote type="cite">Request failed: <ProtocolError for<br>
</blockquote>
<blockquote type="cite">localhost:8080/geospatial/geocoder/XMLRPC: 404 Not Found><br>
</blockquote>
<br>
You should put a resource for each component of the url:<br>
<br>
<span class="Apple-tab-span" style="white-space:pre"></span>root = resource.Resource()<br>
<span class="Apple-tab-span" style="white-space:pre"></span>geospatial = resource.Resource()<br>
<span class="Apple-tab-span" style="white-space:pre"></span>root.putChild('geospatial', geospatial)<br>
<span class="Apple-tab-span" style="white-space:pre"></span>geocoder = resource.Resource()<br>
<span class="Apple-tab-span" style="white-space:pre"></span>geospatial.putChild('geocoder', geocoder)<br>
<span class="Apple-tab-span" style="white-space:pre"></span>xmlrpc = XMLRPCGeocoder()<br>
<span class="Apple-tab-span" style="white-space:pre"></span>geocoder.putChild('XMLRPC', xmlrpc)<br>
<br>
I didn't double checked, but I am pretty sure that this will works.<br>
<br>
<blockquote type="cite">Looking at twisted.web.resource.Resource's source code, all it does is<br>
</blockquote>
<blockquote type="cite">add the path to a hash array and returns nothing...<br>
</blockquote>
<br>
Yes, putChild does this, but this is not how path traversal works. The<br>
path is splitted in segments which are harvested one after the other<br>
until a resource is returned. <br>
<br>
m.<br>
<br>
-- <br>
Dalle virtù che si esigono in un domestico, l'Eccellenza Vostra conosce molti<br>
padroni degni d'esser servitori?<br>
<span class="Apple-tab-span" style="white-space:pre"></span><span class="Apple-tab-span" style="white-space:pre"></span>-- Pierre Augustin Caron de Beaumarchais<br>
<br>
_______________________________________________<br>
Twisted-web mailing list<br>
<a href="mailto:Twisted-web@twistedmatrix.com">Twisted-web@twistedmatrix.com</a><br>
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web<br>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="2">Confidentiality Notice: This e-mail may contain proprietary information some of which may be legally privileged. It is for the intended recipient(s) only. If you believe that it has been sent to you in error, please
notify the sender by reply e-mail and delete the message. Any disclosure, copying, distribution or use of this information by someone other than the intended recipient(s) is prohibited and may be unlawful.<br>
</font>
</body>
</html>