changeset 977:2a9e08136860 plugins

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Jun 2014 16:09:41 +0200
parents 6968356679c0
children 624f44047238
files Core/RestApi/RestApi.cpp Core/RestApi/RestApi.h
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Core/RestApi/RestApi.cpp	Mon Jun 30 14:55:43 2014 +0200
+++ b/Core/RestApi/RestApi.cpp	Mon Jun 30 16:09:41 2014 +0200
@@ -242,24 +242,28 @@
   void RestApi::Register(const std::string& path,
                          RestApiGetCall::Handler handler)
   {
+    root_.Register(path, handler);
     getHandlers_.push_back(std::make_pair(new RestApiPath(path), handler));
   }
 
   void RestApi::Register(const std::string& path,
                          RestApiPutCall::Handler handler)
   {
+    root_.Register(path, handler);
     putHandlers_.push_back(std::make_pair(new RestApiPath(path), handler));
   }
 
   void RestApi::Register(const std::string& path,
                          RestApiPostCall::Handler handler)
   {
+    root_.Register(path, handler);
     postHandlers_.push_back(std::make_pair(new RestApiPath(path), handler));
   }
 
   void RestApi::Register(const std::string& path,
                          RestApiDeleteCall::Handler handler)
   {
+    root_.Register(path, handler);
     deleteHandlers_.push_back(std::make_pair(new RestApiPath(path), handler));
   }
 }
--- a/Core/RestApi/RestApi.h	Mon Jun 30 14:55:43 2014 +0200
+++ b/Core/RestApi/RestApi.h	Mon Jun 30 16:09:41 2014 +0200
@@ -32,13 +32,7 @@
 
 #pragma once
 
-#include "../HttpServer/HttpHandler.h"
-#include "RestApiPath.h"
-#include "RestApiOutput.h"
-#include "RestApiGetCall.h"
-#include "RestApiPutCall.h"
-#include "RestApiPostCall.h"
-#include "RestApiDeleteCall.h"
+#include "RestApiHierarchy.h"
 
 #include <list>
 
@@ -47,6 +41,8 @@
   class RestApi : public HttpHandler
   {
   private:
+    RestApiHierarchy root_;
+
     typedef std::list< std::pair<RestApiPath*, RestApiGetCall::Handler> > GetHandlers;
     typedef std::list< std::pair<RestApiPath*, RestApiPutCall::Handler> > PutHandlers;
     typedef std::list< std::pair<RestApiPath*, RestApiPostCall::Handler> > PostHandlers;