comparison Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 3399:4e8205871967

OrthancPluginRegisterMultipartRestCallback() is working
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Jun 2019 14:14:31 +0200
parents 9019279dbfd7
children 0faae6f6e3c5
comparison
equal deleted inserted replaced
3398:4acd1431e603 3399:4e8205871967
2611 static OrthancPluginMultipartRestHandler* MultipartRestFactory( 2611 static OrthancPluginMultipartRestHandler* MultipartRestFactory(
2612 OrthancPluginMultipartRestFactory* factory, 2612 OrthancPluginMultipartRestFactory* factory,
2613 OrthancPluginHttpMethod method, 2613 OrthancPluginHttpMethod method,
2614 const char* url, 2614 const char* url,
2615 const char* contentType, 2615 const char* contentType,
2616 const char* subType,
2616 uint32_t groupsCount, 2617 uint32_t groupsCount,
2617 const char* const* groups, 2618 const char* const* groups,
2618 uint32_t headersCount, 2619 uint32_t headersCount,
2619 const char* const* headersKeys, 2620 const char* const* headersKeys,
2620 const char* const* headersValues) 2621 const char* const* headersValues)
2637 { 2638 {
2638 headers[headersKeys[i]] = headersValues[i]; 2639 headers[headersKeys[i]] = headersValues[i];
2639 } 2640 }
2640 2641
2641 return reinterpret_cast<OrthancPluginMultipartRestHandler*>( 2642 return reinterpret_cast<OrthancPluginMultipartRestHandler*>(
2642 that.CreateHandler(method, url, contentType, g, headers)); 2643 that.CreateHandler(method, url, contentType,
2644 subType == NULL ? "" : subType, g, headers));
2643 } 2645 }
2644 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) 2646 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
2645 { 2647 {
2646 LogError("Exception while creating a multipart handler"); 2648 LogError("Exception while creating a multipart handler");
2647 return NULL; 2649 return NULL;
2674 return reinterpret_cast<MultipartRestCallback::IHandler*>(handler)-> 2676 return reinterpret_cast<MultipartRestCallback::IHandler*>(handler)->
2675 AddPart(contentType, headers, data, size); 2677 AddPart(contentType, headers, data, size);
2676 } 2678 }
2677 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e) 2679 catch (ORTHANC_PLUGINS_EXCEPTION_CLASS& e)
2678 { 2680 {
2679 LogError("Exception while add a part to a multipart handler"); 2681 LogError("Exception while adding a part to a multipart handler");
2680 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); 2682 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode());
2681 } 2683 }
2682 catch (...) 2684 catch (...)
2683 { 2685 {
2684 LogError("Native exception while add a part to a multipart handler"); 2686 LogError("Native exception while adding a part to a multipart handler");
2685 return OrthancPluginErrorCode_Plugin; 2687 return OrthancPluginErrorCode_Plugin;
2686 } 2688 }
2687 } 2689 }
2688 2690
2689 static OrthancPluginErrorCode MultipartRestExecute( 2691 static OrthancPluginErrorCode MultipartRestExecute(