Mercurial > hg > orthanc
diff Core/RestApi/RestApi.cpp @ 976:6968356679c0 plugins
integration mainline->plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 30 Jun 2014 14:55:43 +0200 |
parents | 7d88f3f4a3b3 c550e99c452b |
children | 2a9e08136860 |
line wrap: on
line diff
--- a/Core/RestApi/RestApi.cpp Mon Jun 30 14:08:51 2014 +0200 +++ b/Core/RestApi/RestApi.cpp Mon Jun 30 14:55:43 2014 +0200 @@ -38,29 +38,6 @@ namespace Orthanc { - bool RestApi::Call::ParseJsonRequestInternal(Json::Value& result, - const char* request) - { - result.clear(); - Json::Reader reader; - return reader.parse(request, result); - } - - - bool RestApi::GetCall::ParseJsonRequest(Json::Value& result) const - { - result.clear(); - - for (HttpHandler::Arguments::const_iterator - it = getArguments_.begin(); it != getArguments_.end(); ++it) - { - result[it->first] = it->second; - } - - return true; - } - - bool RestApi::IsGetAccepted(const UriComponents& uri) { for (GetHandlers::const_iterator it = getHandlers_.begin(); @@ -192,7 +169,7 @@ bool ok = false; RestApiOutput restOutput(output); - RestApiPath::Components components; + HttpHandler::Arguments components; UriComponents trailing; if (method == HttpMethod_Get) @@ -204,7 +181,7 @@ { //LOG(INFO) << "REST GET call on: " << Toolbox::FlattenUri(uri); ok = true; - GetCall call(restOutput, *this, headers, components, trailing, uri, getArguments); + RestApiGetCall call(restOutput, *this, headers, components, trailing, uri, getArguments); it->second(call); } } @@ -218,7 +195,7 @@ { //LOG(INFO) << "REST PUT call on: " << Toolbox::FlattenUri(uri); ok = true; - PutCall call(restOutput, *this, headers, components, trailing, uri, postData); + RestApiPutCall call(restOutput, *this, headers, components, trailing, uri, postData); it->second(call); } } @@ -232,7 +209,7 @@ { //LOG(INFO) << "REST POST call on: " << Toolbox::FlattenUri(uri); ok = true; - PostCall call(restOutput, *this, headers, components, trailing, uri, postData); + RestApiPostCall call(restOutput, *this, headers, components, trailing, uri, postData); it->second(call); } } @@ -246,7 +223,7 @@ { //LOG(INFO) << "REST DELETE call on: " << Toolbox::FlattenUri(uri); ok = true; - DeleteCall call(restOutput, *this, headers, components, trailing, uri); + RestApiDeleteCall call(restOutput, *this, headers, components, trailing, uri); it->second(call); } } @@ -263,25 +240,25 @@ } void RestApi::Register(const std::string& path, - GetHandler handler) + RestApiGetCall::Handler handler) { getHandlers_.push_back(std::make_pair(new RestApiPath(path), handler)); } void RestApi::Register(const std::string& path, - PutHandler handler) + RestApiPutCall::Handler handler) { putHandlers_.push_back(std::make_pair(new RestApiPath(path), handler)); } void RestApi::Register(const std::string& path, - PostHandler handler) + RestApiPostCall::Handler handler) { postHandlers_.push_back(std::make_pair(new RestApiPath(path), handler)); } void RestApi::Register(const std::string& path, - DeleteHandler handler) + RestApiDeleteCall::Handler handler) { deleteHandlers_.push_back(std::make_pair(new RestApiPath(path), handler)); }