comparison 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
comparison
equal deleted inserted replaced
898:7000fc86fe62 899:bb0a51561016
372 context.SetCompressionEnabled(Configuration::GetGlobalBoolParameter("StorageCompression", false)); 372 context.SetCompressionEnabled(Configuration::GetGlobalBoolParameter("StorageCompression", false));
373 context.SetStoreMD5ForAttachments(Configuration::GetGlobalBoolParameter("StoreMD5ForAttachments", true)); 373 context.SetStoreMD5ForAttachments(Configuration::GetGlobalBoolParameter("StoreMD5ForAttachments", true));
374 374
375 LoadLuaScripts(context); 375 LoadLuaScripts(context);
376 376
377 PluginsHttpHandler httpPlugins;
378
377 PluginsManager pluginsManager; 379 PluginsManager pluginsManager;
380 pluginsManager.RegisterServiceProvider(httpPlugins);
378 LoadPlugins(pluginsManager); 381 LoadPlugins(pluginsManager);
379 382
380 try 383 try
381 { 384 {
382 context.GetIndex().SetMaximumPatientCount(Configuration::GetGlobalIntegerParameter("MaximumPatientCount", 0)); 385 context.GetIndex().SetMaximumPatientCount(Configuration::GetGlobalIntegerParameter("MaximumPatientCount", 0));
430 else 433 else
431 { 434 {
432 httpServer.SetSslEnabled(false); 435 httpServer.SetSslEnabled(false);
433 } 436 }
434 437
435 httpServer.RegisterHandler(new PluginsHttpHandler(pluginsManager)); 438 OrthancRestApi restApi(context);
436 439
437 #if ORTHANC_STANDALONE == 1 440 #if ORTHANC_STANDALONE == 1
438 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::ORTHANC_EXPLORER)); 441 EmbeddedResourceHttpHandler staticResources("/app", EmbeddedResources::ORTHANC_EXPLORER);
439 #else 442 #else
440 httpServer.RegisterHandler(new FilesystemHttpHandler("/app", ORTHANC_PATH "/OrthancExplorer")); 443 FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer");
441 #endif 444 #endif
442 445
443 httpServer.RegisterHandler(new OrthancRestApi(context)); 446 httpServer.RegisterHandler(httpPlugins);
447 httpServer.RegisterHandler(staticResources);
448 httpServer.RegisterHandler(restApi);
444 449
445 // GO !!! Start the requested servers 450 // GO !!! Start the requested servers
446 if (Configuration::GetGlobalBoolParameter("HttpServerEnabled", true)) 451 if (Configuration::GetGlobalBoolParameter("HttpServerEnabled", true))
447 { 452 {
448 httpServer.Start(); 453 httpServer.Start();