Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 1437:02f5a3f5c0a0
access to the REST API from Lua
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Jun 2015 18:41:33 +0200 |
parents | 0a3e3be59094 |
children | f3672356c121 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Tue Jun 30 17:19:26 2015 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Jun 30 18:41:33 2015 +0200 @@ -33,7 +33,7 @@ #include "OrthancPlugins.h" #include "../../Core/ChunkedBuffer.h" -#include "../../Core/HttpServer/HttpOutput.h" +#include "../../Core/HttpServer/StringHttpOutput.h" #include "../../Core/ImageFormats/PngWriter.h" #include "../../Core/OrthancException.h" #include "../../Core/Toolbox.h" @@ -109,39 +109,6 @@ } - namespace - { - // Anonymous namespace to avoid clashes between compilation modules - class StringHttpOutput : public IHttpOutputStream - { - private: - ChunkedBuffer buffer_; - - public: - void GetOutput(std::string& output) - { - buffer_.Flatten(output); - } - - virtual void OnHttpStatusReceived(HttpStatus status) - { - if (status != HttpStatus_200_Ok) - { - throw OrthancException(ErrorCode_BadRequest); - } - } - - virtual void Send(bool isHeader, const void* buffer, size_t length) - { - if (!isHeader) - { - buffer_.AddChunk(reinterpret_cast<const char*>(buffer), length); - } - } - }; - } - - struct OrthancPlugins::PImpl { @@ -649,6 +616,8 @@ const _OrthancPluginRestApiGet& p = *reinterpret_cast<const _OrthancPluginRestApiGet*>(parameters); + // TODO : Use "HttpHandler::SimpleGet()" + HttpHandler::Arguments headers; // No HTTP header std::string body; // No body for a GET request