--- rest_server/includes/RESTServer.inc.orig    2011-05-31 09:46:23.000000000 +0200
+++ rest_server/includes/RESTServer.inc 2011-05-31 11:26:50.000000000 +0200
@@ -52,6 +52,8 @@ class RESTServer {
       // Get the operation and fill with default values
       $controller = $this->resolveController($resource, $method, $path);

+      $controller['resource_name'] = $resource_name;
+
       if ($controller) {
         $this->setDefaultOperationAttributes($controller);

@@ -550,7 +552,8 @@ class RESTServer {
     $pc = count($path);
     // Use the index handler for all empty path request, except on POST
     if (!$pc && $method!='POST') {
-      return isset($resource['index']) ? $resource['index'] : NULL;
+      $controller = isset($resource['index']) ? $resource['index'] : NULL;
+      $controller['resource_type'] = 'index';
     }
     // Detect the standard crud operations
     else if (
@@ -563,24 +566,28 @@ class RESTServer {
         'DELETE' => 'delete',
       );
       if (isset($resource[$action_mapping[$method]])) {
-        return $resource[$action_mapping[$method]];
+        $controller = $resource[$action_mapping[$method]];
+        $controller['resource_type'] = $action_mapping[$method];
       }
     }
     // Detect relationship requests
     else if ($pc>=2 && $method=='GET') {
       if (isset($resource['relationships']) && $resource['relationships'][$path[1]]) {
-        $relationship = $resource['relationships'][$path[1]];
-        return $relationship;
+        $controller = $resource['relationships'][$path[1]];
+        $controller['resource_type'] = $path[0];
       }
     }
     // Detect action requests
     else if ($pc==1 && $method=='POST') {
-      return $resource['actions'][$path[0]];
+      $controller = $resource['actions'][$path[0]];
+      $controller['resource_type'] = $path[0];
     }
     // Detect action requests targeted at specific resources
     else if ($pc>=2 && $method=='POST') {
-      $action = $resource['targeted actions'][$path[1]];
-      return $action;
+      $controller = $resource['targeted actions'][$path[1]];
+      $controller['resource_type'] = $path[1];
     }
+
+    return $controller;
   }
-}
\ Pas de fin de ligne à la fin du fichier.
+}