diff OrthancServer/main.cpp @ 899:bb0a51561016 plugins

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Jun 2014 13:29:09 +0200
parents bafc9d592632
children 2732b5f57d9c
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Wed Jun 18 09:18:28 2014 +0200
+++ b/OrthancServer/main.cpp	Wed Jun 18 13:29:09 2014 +0200
@@ -374,7 +374,10 @@
 
     LoadLuaScripts(context);
 
+    PluginsHttpHandler httpPlugins;
+
     PluginsManager pluginsManager;
+    pluginsManager.RegisterServiceProvider(httpPlugins);
     LoadPlugins(pluginsManager);
 
     try
@@ -432,15 +435,17 @@
         httpServer.SetSslEnabled(false);
       }
 
-      httpServer.RegisterHandler(new PluginsHttpHandler(pluginsManager));
+      OrthancRestApi restApi(context);
 
 #if ORTHANC_STANDALONE == 1
-      httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::ORTHANC_EXPLORER));
+      EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER);
 #else
-      httpServer.RegisterHandler(new FilesystemHttpHandler("/app", ORTHANC_PATH "/OrthancExplorer"));
+      FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer");
 #endif
 
-      httpServer.RegisterHandler(new OrthancRestApi(context));
+      httpServer.RegisterHandler(httpPlugins);
+      httpServer.RegisterHandler(staticResources);
+      httpServer.RegisterHandler(restApi);
 
       // GO !!! Start the requested servers
       if (Configuration::GetGlobalBoolParameter("HttpServerEnabled", true))