Mercurial > hg > orthanc
comparison Plugins/Samples/Common/OrthancPluginCppWrapper.h @ 3438:d97ef941d521
compatibility mode for OrthancPlugins::HttpClient::IAnswer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Jun 2019 22:13:00 +0200 |
parents | dbaf439c8888 |
children | 0371b65d5f76 |
comparison
equal
deleted
inserted
replaced
3437:dbaf439c8888 | 3438:d97ef941d521 |
---|---|
812 } | 812 } |
813 | 813 |
814 virtual bool ReadNextChunk(std::string& chunk) = 0; | 814 virtual bool ReadNextChunk(std::string& chunk) = 0; |
815 }; | 815 }; |
816 | 816 |
817 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 | 817 |
818 class IAnswer : public boost::noncopyable | 818 class IAnswer : public boost::noncopyable |
819 { | 819 { |
820 public: | 820 public: |
821 virtual ~IAnswer() | 821 virtual ~IAnswer() |
822 { | 822 { |
826 const std::string& value) = 0; | 826 const std::string& value) = 0; |
827 | 827 |
828 virtual void AddChunk(const void* data, | 828 virtual void AddChunk(const void* data, |
829 size_t size) = 0; | 829 size_t size) = 0; |
830 }; | 830 }; |
831 #endif | |
832 | 831 |
833 | 832 |
834 private: | 833 private: |
835 class RequestBodyWrapper; | 834 class RequestBodyWrapper; |
836 | 835 |
922 | 921 |
923 void SetBody(const std::string& body); | 922 void SetBody(const std::string& body); |
924 | 923 |
925 void SetBody(IRequestBody& body); | 924 void SetBody(IRequestBody& body); |
926 | 925 |
927 #if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 | |
928 void Execute(IAnswer& answer); | 926 void Execute(IAnswer& answer); |
929 #endif | |
930 | 927 |
931 void Execute(HttpHeaders& answerHeaders /* out */, | 928 void Execute(HttpHeaders& answerHeaders /* out */, |
932 std::string& answerBody /* out */); | 929 std::string& answerBody /* out */); |
933 | 930 |
934 void Execute(HttpHeaders& answerHeaders /* out */, | 931 void Execute(HttpHeaders& answerHeaders /* out */, |
1069 PutHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PutHandler>, | 1066 PutHandler == Internals::NullChunkedRestCallback ? NULL : Internals::ChunkedProtect<PutHandler>, |
1070 Internals::ChunkedRequestReaderAddChunk, | 1067 Internals::ChunkedRequestReaderAddChunk, |
1071 Internals::ChunkedRequestReaderExecute, | 1068 Internals::ChunkedRequestReaderExecute, |
1072 Internals::ChunkedRequestReaderFinalize); | 1069 Internals::ChunkedRequestReaderFinalize); |
1073 #else | 1070 #else |
1074 LogWarning("Performance warning: The plugin was compiled against a pre-1.5.7 version " | |
1075 "of the Orthanc SDK. Multipart transfers will be entirely stored in RAM."); | |
1076 | |
1077 OrthancPluginRegisterRestCallbackNoLock( | 1071 OrthancPluginRegisterRestCallbackNoLock( |
1078 GetGlobalContext(), uri.c_str(), | 1072 GetGlobalContext(), uri.c_str(), |
1079 Internals::ChunkedRestCompatibility<GetHandler, PostHandler, DeleteHandler, PutHandler>); | 1073 Internals::ChunkedRestCompatibility<GetHandler, PostHandler, DeleteHandler, PutHandler>); |
1080 #endif | 1074 #endif |
1081 } | 1075 } |