# HG changeset patch # User Sebastien Jodogne # Date 1560280069 -7200 # Node ID a0e72a40f5d53aeb6a3ec3a8cb589d0638952a78 # Parent ca7f14c91abf049db366ab38ecee1e15453c7e50 cont diff -r ca7f14c91abf -r a0e72a40f5d5 Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Tue Jun 11 19:44:29 2019 +0200 +++ b/Plugin/Plugin.cpp Tue Jun 11 21:07:49 2019 +0200 @@ -31,56 +31,6 @@ #include -OrthancPlugins::IChunkedRequestReader* SwitchStudies(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) -{ - switch (request->method) - { - case OrthancPluginHttpMethod_Get: - // This is QIDO-RS - SearchForStudies(output, url, request); - return NULL; - - case OrthancPluginHttpMethod_Post: - // This is STOW-RS - return OrthancPlugins::StowServer::PostCallback(url, request); - - default: - if (output != NULL) - { - OrthancPluginSendMethodNotAllowed(OrthancPlugins::GetGlobalContext(), output, "GET,POST"); // TODO - } - return NULL; - } -} - - -OrthancPlugins::IChunkedRequestReader* SwitchIndividualStudy(OrthancPluginRestOutput* output, - const char* url, - const OrthancPluginHttpRequest* request) -{ - switch (request->method) - { - case OrthancPluginHttpMethod_Get: - // This is WADO-RS - RetrieveDicomStudy(output, url, request); - return NULL; - - case OrthancPluginHttpMethod_Post: - // This is STOW-RS - return OrthancPlugins::StowServer::PostCallback(url, request); - - default: - if (output != NULL) - { - OrthancPluginSendMethodNotAllowed(OrthancPlugins::GetGlobalContext(), output, "GET,POST"); // TODO - } - return NULL; - } -} - - bool RequestHasKey(const OrthancPluginHttpRequest* request, const char* key) { for (uint32_t i = 0; i < request->getCount; i++) @@ -325,8 +275,13 @@ OrthancPlugins::LogWarning("URI to the DICOMweb REST API: " + root); - OrthancPlugins::RegisterChunkedRestCallback(root + "studies"); - OrthancPlugins::RegisterChunkedRestCallback(root + "studies/([^/]*)"); + OrthancPlugins::RegisterChunkedRestCallback< + SearchForStudies /* TODO => Rename as QIDO-RS */, + OrthancPlugins::StowServer::PostCallback>(root + "studies"); + + OrthancPlugins::RegisterChunkedRestCallback< + RetrieveDicomStudy /* TODO => Rename as WADO-RS */, + OrthancPlugins::StowServer::PostCallback>(root + "studies/([^/]*)"); OrthancPlugins::RegisterRestCallback(root + "instances", true); OrthancPlugins::RegisterRestCallback(root + "series", true);