diff Core/RestApi/RestApi.cpp @ 1063:0332e6e8c679

Fix automated generation of the list of resource children in the REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Jul 2014 16:06:26 +0200
parents 00f9f36bcd94
children ba5c0908600c
line wrap: on
line diff
--- a/Core/RestApi/RestApi.cpp	Fri Jul 25 14:51:18 2014 +0200
+++ b/Core/RestApi/RestApi.cpp	Fri Jul 25 16:06:26 2014 +0200
@@ -195,13 +195,6 @@
       return true;
     }
 
-    Json::Value directory;
-    if (root_.GetDirectory(directory, uri))
-    {
-      wrappedOutput.AnswerJson(directory);
-      return true;
-    }
-
     std::set<HttpMethod> methods;
     root_.GetAcceptedMethods(methods, uri);
 
@@ -243,4 +236,15 @@
   {
     root_.Register(path, handler);
   }
+  
+  void RestApi::AutoListChildren(RestApiGetCall& call)
+  {
+    RestApi& context = call.GetContext();
+
+    Json::Value directory;
+    if (context.root_.GetDirectory(directory, call.GetFullUri()))
+    {
+      call.GetOutput().AnswerJson(directory);
+    }    
+  }
 }