Mercurial > hg > orthanc
diff Core/RestApi/RestApi.cpp @ 210:96b7918a6a18
start of the refactoring of the Orthanc REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Nov 2012 18:03:44 +0100 |
parents | 9960642f0f45 |
children | c07170f3f4f7 |
line wrap: on
line diff
--- a/Core/RestApi/RestApi.cpp Wed Nov 28 17:22:07 2012 +0100 +++ b/Core/RestApi/RestApi.cpp Wed Nov 28 18:03:44 2012 +0100 @@ -32,6 +32,8 @@ #include "RestApi.h" +#include <glog/logging.h> + namespace Orthanc { bool RestApi::IsGetAccepted(const UriComponents& uri) @@ -164,7 +166,7 @@ RestApiOutput restOutput(output); RestApiPath::Components components; UriComponents trailing; - + if (method == "GET") { for (GetHandlers::const_iterator it = getHandlers_.begin(); @@ -172,10 +174,11 @@ { if (it->first->Match(components, trailing, uri)) { + LOG(INFO) << "REST GET call on: " << Toolbox::FlattenUri(uri); ok = true; GetCall call; call.output_ = &restOutput; - call.context_ = context_.get(); + call.context_ = this; call.httpHeaders_ = &headers; call.uriComponents_ = &components; call.trailing_ = &trailing; @@ -192,10 +195,11 @@ { if (it->first->Match(components, trailing, uri)) { + LOG(INFO) << "REST PUT call on: " << Toolbox::FlattenUri(uri); ok = true; PutCall call; call.output_ = &restOutput; - call.context_ = context_.get(); + call.context_ = this; call.httpHeaders_ = &headers; call.uriComponents_ = &components; call.trailing_ = &trailing; @@ -212,10 +216,11 @@ { if (it->first->Match(components, trailing, uri)) { + LOG(INFO) << "REST POST call on: " << Toolbox::FlattenUri(uri); ok = true; PostCall call; call.output_ = &restOutput; - call.context_ = context_.get(); + call.context_ = this; call.httpHeaders_ = &headers; call.uriComponents_ = &components; call.trailing_ = &trailing; @@ -232,10 +237,11 @@ { if (it->first->Match(components, trailing, uri)) { + LOG(INFO) << "REST DELETE call on: " << Toolbox::FlattenUri(uri); ok = true; DeleteCall call; call.output_ = &restOutput; - call.context_ = context_.get(); + call.context_ = this; call.httpHeaders_ = &headers; call.uriComponents_ = &components; call.trailing_ = &trailing; @@ -246,6 +252,7 @@ if (!ok) { + LOG(INFO) << "REST method " << method << " not allowed on: " << Toolbox::FlattenUri(uri); output.SendMethodNotAllowedError(GetAcceptedMethods(uri)); } }