diff OrthancServer/main.cpp @ 1444:b2b09a3dbd8e

refactoring: OrthancHttpHandler inside OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2015 12:09:58 +0200
parents 895ab369d63c
children 5ba7471780ae
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Wed Jul 01 11:30:19 2015 +0200
+++ b/OrthancServer/main.cpp	Wed Jul 01 12:09:58 2015 +0200
@@ -51,7 +51,6 @@
 #include "ServerToolbox.h"
 #include "../Plugins/Engine/OrthancPlugins.h"
 #include "FromDcmtkBridge.h"
-#include "OrthancHttpHandler.h"
 
 using namespace Orthanc;
 
@@ -435,12 +434,10 @@
   }
 
 
-  OrthancHttpHandler httpHandler;
-
 #if ENABLE_PLUGINS == 1
   OrthancRestApi restApi(*context);
   plugins.SetServerContext(*context);
-  httpHandler.Register(plugins, false);
+  context->GetHttpHandler().Register(plugins, false);
   context->SetPlugins(plugins);
 #endif
 
@@ -450,9 +447,8 @@
   FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer");
 #endif
 
-  httpHandler.Register(staticResources, false);
-  httpHandler.Register(restApi, true);
-
+  context->GetHttpHandler().Register(staticResources, false);
+  context->GetHttpHandler().Register(restApi, true);
 
 
   MyDicomServerFactory serverFactory(*context);
@@ -493,7 +489,7 @@
       httpServer.SetSslEnabled(false);
     }
 
-    httpServer.Register(httpHandler);
+    httpServer.Register(context->GetHttpHandler());
 
 
 #if ENABLE_PLUGINS == 1
@@ -510,7 +506,6 @@
     }
     
     context->SetStorageArea(*storage);
-    context->GetLua().SetOrthancRestApi(restApi);
 
     // GO !!! Start the requested servers
     if (Configuration::GetGlobalBoolParameter("HttpServerEnabled", true))
@@ -556,8 +551,6 @@
     LOG(WARNING) << "    Plugins have stopped";
 #endif
 
-    context->GetLua().ResetOrthancRestApi();
-
     dicomServer.Stop();
     LOG(WARNING) << "    DICOM server has stopped";