  
      def locateResource(self, url):
          """
-@@ -385,8 +401,13 @@
+@@ -385,8 +397,13 @@
              The contained response will have a status code of
              L{responsecode.BAD_REQUEST}.
          """

+                return f
+            return None
+
+        def _registerResource(child):
+            self._resourcesByURL[child] = url
+            self._urlsByResource[url] = child
+            return child
+        
+        d = defer.maybeDeferred(self._getChild, None, res, [segment], updatepaths=False)
+        d.addCallback(_registerResource)
+        return d
+
     def _processingFailed(self, reason):

 
     def unparseURL(self, scheme=None, host=None, port=None,
                    path=None, params=None, querystring=None, fragment=None):
@@ -265,6 +282,7 @@
         
         d = defer.Deferred()
         d.addCallback(self._getChild, self.site.resource, self.postpath)
+        d.addCallback(self._rememberResource, "/" + "/".join(self.prepath))
         d.addCallback(lambda res, req: res.renderHTTP(req), self)
         d.addCallback(self._cbFinishRender)
         d.addErrback(self._processingFailed)
@@ -320,8 +338,6 @@
                     url = "/" + "/".join(path)
                 else:
                     url = "/"
