changeset 974:83622b0f544c

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Jun 2014 14:44:05 +0200
parents 2047e6f033bd
children c550e99c452b
files CMakeLists.txt Core/RestApi/RestApi.cpp Core/RestApi/RestApi.h Core/RestApi/RestApiCall.cpp Core/RestApi/RestApiCall.h Core/RestApi/RestApiDeleteCall.h Core/RestApi/RestApiGetCall.cpp Core/RestApi/RestApiGetCall.h Core/RestApi/RestApiHierarchy.cpp Core/RestApi/RestApiHierarchy.h Core/RestApi/RestApiPostCall.h Core/RestApi/RestApiPutCall.h OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp OrthancServer/OrthancRestApi/OrthancRestApi.cpp OrthancServer/OrthancRestApi/OrthancRestApi.h OrthancServer/OrthancRestApi/OrthancRestArchive.cpp OrthancServer/OrthancRestApi/OrthancRestChanges.cpp OrthancServer/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/OrthancRestApi/OrthancRestSystem.cpp UnitTestsSources/RestApiTests.cpp
diffstat 21 files changed, 617 insertions(+), 358 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Jun 30 14:08:15 2014 +0200
+++ b/CMakeLists.txt	Mon Jun 30 14:44:05 2014 +0200
@@ -84,6 +84,8 @@
   Core/HttpServer/MongooseServer.cpp
   Core/HttpServer/HttpFileSender.cpp
   Core/HttpServer/FilesystemHttpSender.cpp
+  Core/RestApi/RestApiCall.cpp
+  Core/RestApi/RestApiGetCall.cpp
   Core/RestApi/RestApiHierarchy.cpp
   Core/RestApi/RestApiPath.cpp
   Core/RestApi/RestApiOutput.cpp
--- a/Core/RestApi/RestApi.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/Core/RestApi/RestApi.cpp	Mon Jun 30 14:44:05 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();
@@ -201,7 +178,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);
         }
       }
@@ -215,7 +192,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);
         }
       }
@@ -229,7 +206,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);
         }
       }
@@ -243,7 +220,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);
         }
       }
@@ -258,25 +235,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));
   }
--- a/Core/RestApi/RestApi.h	Mon Jun 30 14:08:15 2014 +0200
+++ b/Core/RestApi/RestApi.h	Mon Jun 30 14:44:05 2014 +0200
@@ -35,6 +35,10 @@
 #include "../HttpServer/HttpHandler.h"
 #include "RestApiPath.h"
 #include "RestApiOutput.h"
+#include "RestApiGetCall.h"
+#include "RestApiPutCall.h"
+#include "RestApiPostCall.h"
+#include "RestApiDeleteCall.h"
 
 #include <list>
 
@@ -42,215 +46,11 @@
 {
   class RestApi : public HttpHandler
   {
-  public:
-    class Call
-    {
-      friend class RestApi;
-
-    private:
-      RestApiOutput& output_;
-      RestApi& context_;
-      const HttpHandler::Arguments& httpHeaders_;
-      const RestApiPath::Components& uriComponents_;
-      const UriComponents& trailing_;
-      const UriComponents& fullUri_;
-
-      Call(RestApiOutput& output,
-           RestApi& context,
-           const HttpHandler::Arguments& httpHeaders,
-           const RestApiPath::Components& uriComponents,
-           const UriComponents& trailing,
-           const UriComponents& fullUri) :
-        output_(output),
-        context_(context),
-        httpHeaders_(httpHeaders),
-        uriComponents_(uriComponents),
-        trailing_(trailing),
-        fullUri_(fullUri)
-      {
-      }
-
-    protected:
-      static bool ParseJsonRequestInternal(Json::Value& result,
-                                           const char* request);
-
-    public:
-      RestApiOutput& GetOutput()
-      {
-        return output_;
-      }
-
-      RestApi& GetContext()
-      {
-        return context_;
-      }
-    
-      const UriComponents& GetFullUri() const
-      {
-        return fullUri_;
-      }
-    
-      const UriComponents& GetTrailingUri() const
-      {
-        return trailing_;
-      }
-
-      std::string GetUriComponent(const std::string& name,
-                                  const std::string& defaultValue) const
-      {
-        return HttpHandler::GetArgument(uriComponents_, name, defaultValue);
-      }
-
-      std::string GetHttpHeader(const std::string& name,
-                                const std::string& defaultValue) const
-      {
-        return HttpHandler::GetArgument(httpHeaders_, name, defaultValue);
-      }
-
-      const HttpHandler::Arguments& GetHttpHeaders() const
-      {
-        return httpHeaders_;
-      }
-
-      void ParseCookies(HttpHandler::Arguments& result) const
-      {
-        HttpHandler::ParseCookies(result, httpHeaders_);
-      }
-
-      virtual bool ParseJsonRequest(Json::Value& result) const = 0;
-    };
-
- 
-    class GetCall : public Call
-    {
-      friend class RestApi;
-
-    private:
-      const HttpHandler::Arguments& getArguments_;
-
-    public:
-      GetCall(RestApiOutput& output,
-              RestApi& context,
-              const HttpHandler::Arguments& httpHeaders,
-              const RestApiPath::Components& uriComponents,
-              const UriComponents& trailing,
-              const UriComponents& fullUri,
-              const HttpHandler::Arguments& getArguments) :
-        Call(output, context, httpHeaders, uriComponents, trailing, fullUri),
-        getArguments_(getArguments)
-      {
-      }
-
-      std::string GetArgument(const std::string& name,
-                              const std::string& defaultValue) const
-      {
-        return HttpHandler::GetArgument(getArguments_, name, defaultValue);
-      }
-
-      bool HasArgument(const std::string& name) const
-      {
-        return getArguments_.find(name) != getArguments_.end();
-      }
-
-      virtual bool ParseJsonRequest(Json::Value& result) const;
-    };
-
-
-    class PutCall : public Call
-    {
-      friend class RestApi;
-
-    private:
-      const std::string& data_;
-
-    public:
-      PutCall(RestApiOutput& output,
-              RestApi& context,
-              const HttpHandler::Arguments& httpHeaders,
-              const RestApiPath::Components& uriComponents,
-              const UriComponents& trailing,
-              const UriComponents& fullUri,
-              const std::string& data) :
-        Call(output, context, httpHeaders, uriComponents, trailing, fullUri),
-        data_(data)
-      {
-      }
-
-      const std::string& GetPutBody() const
-      {
-        return data_;
-      }
-
-      virtual bool ParseJsonRequest(Json::Value& result) const
-      {
-        return ParseJsonRequestInternal(result, GetPutBody().c_str());
-      }      
-    };
-
-    class PostCall : public Call
-    {
-      friend class RestApi;
-
-    private:
-      const std::string& data_;
-
-    public:
-      PostCall(RestApiOutput& output,
-               RestApi& context,
-               const HttpHandler::Arguments& httpHeaders,
-               const RestApiPath::Components& uriComponents,
-               const UriComponents& trailing,
-               const UriComponents& fullUri,
-               const std::string& data) :
-        Call(output, context, httpHeaders, uriComponents, trailing, fullUri),
-        data_(data)
-      {
-      }
-
-      const std::string& GetPostBody() const
-      {
-        return data_;
-      }
-
-      virtual bool ParseJsonRequest(Json::Value& result) const
-      {
-        return ParseJsonRequestInternal(result, GetPostBody().c_str());
-      }      
-    };
-
-    class DeleteCall : public Call
-    {
-    public:
-      DeleteCall(RestApiOutput& output,
-                 RestApi& context,
-                 const HttpHandler::Arguments& httpHeaders,
-                 const RestApiPath::Components& uriComponents,
-                 const UriComponents& trailing,
-                 const UriComponents& fullUri) :
-        Call(output, context, httpHeaders, uriComponents, trailing, fullUri)
-      {
-      }
-
-      virtual bool ParseJsonRequest(Json::Value& result) const
-      {
-        result.clear();
-        return true;
-      }
-    };
-
-    typedef void (*GetHandler) (GetCall& call);
-    
-    typedef void (*DeleteHandler) (DeleteCall& call);
-    
-    typedef void (*PutHandler) (PutCall& call);
-    
-    typedef void (*PostHandler) (PostCall& call);
-    
   private:
-    typedef std::list< std::pair<RestApiPath*, GetHandler> > GetHandlers;
-    typedef std::list< std::pair<RestApiPath*, PutHandler> > PutHandlers;
-    typedef std::list< std::pair<RestApiPath*, PostHandler> > PostHandlers;
-    typedef std::list< std::pair<RestApiPath*, DeleteHandler> > DeleteHandlers;
+    typedef std::list< std::pair<RestApiPath*, RestApiGetCall::Handler> > GetHandlers;
+    typedef std::list< std::pair<RestApiPath*, RestApiPutCall::Handler> > PutHandlers;
+    typedef std::list< std::pair<RestApiPath*, RestApiPostCall::Handler> > PostHandlers;
+    typedef std::list< std::pair<RestApiPath*, RestApiDeleteCall::Handler> > DeleteHandlers;
 
     GetHandlers  getHandlers_;
     PutHandlers  putHandlers_;
@@ -281,15 +81,15 @@
                         const std::string& postData);
 
     void Register(const std::string& path,
-                  GetHandler handler);
+                  RestApiGetCall::Handler handler);
 
     void Register(const std::string& path,
-                  PutHandler handler);
+                  RestApiPutCall::Handler handler);
 
     void Register(const std::string& path,
-                  PostHandler handler);
+                  RestApiPostCall::Handler handler);
 
     void Register(const std::string& path,
-                  DeleteHandler handler);
+                  RestApiDeleteCall::Handler handler);
   };
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiCall.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,44 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#include "RestApiCall.h"
+
+namespace Orthanc
+{
+  bool RestApiCall::ParseJsonRequestInternal(Json::Value& result,
+                                             const char* request)
+  {
+    result.clear();
+    Json::Reader reader;
+    return reader.parse(request, result);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiCall.h	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,117 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "../HttpServer/HttpHandler.h"
+#include "RestApiPath.h"
+#include "RestApiOutput.h"
+
+namespace Orthanc
+{
+  class RestApi;
+
+  class RestApiCall
+  {
+  private:
+    RestApiOutput& output_;
+    RestApi& context_;
+    const HttpHandler::Arguments& httpHeaders_;
+    const RestApiPath::Components& uriComponents_;
+    const UriComponents& trailing_;
+    const UriComponents& fullUri_;
+
+  protected:
+    static bool ParseJsonRequestInternal(Json::Value& result,
+                                         const char* request);
+
+  public:
+    RestApiCall(RestApiOutput& output,
+                RestApi& context,
+                const HttpHandler::Arguments& httpHeaders,
+                const RestApiPath::Components& uriComponents,
+                const UriComponents& trailing,
+                const UriComponents& fullUri) :
+      output_(output),
+      context_(context),
+      httpHeaders_(httpHeaders),
+      uriComponents_(uriComponents),
+      trailing_(trailing),
+      fullUri_(fullUri)
+    {
+    }
+
+    RestApiOutput& GetOutput()
+    {
+      return output_;
+    }
+
+    RestApi& GetContext()
+    {
+      return context_;
+    }
+    
+    const UriComponents& GetFullUri() const
+    {
+      return fullUri_;
+    }
+    
+    const UriComponents& GetTrailingUri() const
+    {
+      return trailing_;
+    }
+
+    std::string GetUriComponent(const std::string& name,
+                                const std::string& defaultValue) const
+    {
+      return HttpHandler::GetArgument(uriComponents_, name, defaultValue);
+    }
+
+    std::string GetHttpHeader(const std::string& name,
+                              const std::string& defaultValue) const
+    {
+      return HttpHandler::GetArgument(httpHeaders_, name, defaultValue);
+    }
+
+    const HttpHandler::Arguments& GetHttpHeaders() const
+    {
+      return httpHeaders_;
+    }
+
+    void ParseCookies(HttpHandler::Arguments& result) const
+    {
+      HttpHandler::ParseCookies(result, httpHeaders_);
+    }
+
+    virtual bool ParseJsonRequest(Json::Value& result) const = 0;
+  };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiDeleteCall.h	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,60 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "RestApiCall.h"
+
+namespace Orthanc
+{
+  class RestApiDeleteCall : public RestApiCall
+  {
+  public:
+    typedef void (*Handler) (RestApiDeleteCall& call);
+    
+    RestApiDeleteCall(RestApiOutput& output,
+                      RestApi& context,
+                      const HttpHandler::Arguments& httpHeaders,
+                      const RestApiPath::Components& uriComponents,
+                      const UriComponents& trailing,
+                      const UriComponents& fullUri) :
+      RestApiCall(output, context, httpHeaders, uriComponents, trailing, fullUri)
+    {
+    }
+
+    virtual bool ParseJsonRequest(Json::Value& result) const
+    {
+      result.clear();
+      return true;
+    }
+  };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiGetCall.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,49 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#include "RestApiGetCall.h"
+
+namespace Orthanc
+{
+  bool RestApiGetCall::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;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiGetCall.h	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,72 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "RestApiCall.h"
+
+namespace Orthanc
+{
+  class RestApiGetCall : public RestApiCall
+  {
+  private:
+    const HttpHandler::Arguments& getArguments_;
+
+  public:
+    typedef void (*Handler) (RestApiGetCall& call);   
+
+    RestApiGetCall(RestApiOutput& output,
+                   RestApi& context,
+                   const HttpHandler::Arguments& httpHeaders,
+                   const RestApiPath::Components& uriComponents,
+                   const UriComponents& trailing,
+                   const UriComponents& fullUri,
+                   const HttpHandler::Arguments& getArguments) :
+      RestApiCall(output, context, httpHeaders, uriComponents, trailing, fullUri),
+      getArguments_(getArguments)
+    {
+    }
+
+    std::string GetArgument(const std::string& name,
+                            const std::string& defaultValue) const
+    {
+      return HttpHandler::GetArgument(getArguments_, name, defaultValue);
+    }
+
+    bool HasArgument(const std::string& name) const
+    {
+      return getArguments_.find(name) != getArguments_.end();
+    }
+
+    virtual bool ParseJsonRequest(Json::Value& result) const;
+  };
+}
--- a/Core/RestApi/RestApiHierarchy.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/Core/RestApi/RestApiHierarchy.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -76,25 +76,25 @@
   }
 
 
-  RestApi::GetHandler RestApiHierarchy::Handlers::GetGetHandler() const
+  RestApiGetCall::Handler RestApiHierarchy::Handlers::GetGetHandler() const
   {
     assert(getHandler_ != NULL);
     return getHandler_;
   }
 
-  RestApi::PutHandler RestApiHierarchy::Handlers::GetPutHandler() const
+  RestApiPutCall::Handler RestApiHierarchy::Handlers::GetPutHandler() const
   {
     assert(putHandler_ != NULL);
     return putHandler_;
   }
 
-  RestApi::PostHandler RestApiHierarchy::Handlers::GetPostHandler() const
+  RestApiPostCall::Handler RestApiHierarchy::Handlers::GetPostHandler() const
   {
     assert(postHandler_ != NULL);
     return postHandler_;
   }
 
-  RestApi::DeleteHandler RestApiHierarchy::Handlers::GetDeleteHandler() const
+  RestApiDeleteCall::Handler RestApiHierarchy::Handlers::GetDeleteHandler() const
   {
     assert(deleteHandler_ != NULL);
     return deleteHandler_;
@@ -286,7 +286,7 @@
   {
     if (handlers.HasHandler(HttpMethod_Get))
     {
-      handlers.GetGetHandler() (*reinterpret_cast<RestApi::GetCall*>(call));
+      handlers.GetGetHandler() (*reinterpret_cast<RestApiGetCall*>(call));
       return true;
     }
     else
@@ -304,7 +304,7 @@
   {
     if (handlers.HasHandler(HttpMethod_Post))
     {
-      handlers.GetPostHandler() (*reinterpret_cast<RestApi::PostCall*>(call));
+      handlers.GetPostHandler() (*reinterpret_cast<RestApiPostCall*>(call));
       return true;
     }
     else
@@ -322,7 +322,7 @@
   {
     if (handlers.HasHandler(HttpMethod_Put))
     {
-      handlers.GetPutHandler() (*reinterpret_cast<RestApi::PutCall*>(call));
+      handlers.GetPutHandler() (*reinterpret_cast<RestApiPutCall*>(call));
       return true;
     }
     else
@@ -340,7 +340,7 @@
   {
     if (handlers.HasHandler(HttpMethod_Delete))
     {
-      handlers.GetDeleteHandler() (*reinterpret_cast<RestApi::DeleteCall*>(call));
+      handlers.GetDeleteHandler() (*reinterpret_cast<RestApiDeleteCall*>(call));
       return true;
     }
     else
@@ -357,28 +357,28 @@
   }
 
   void RestApiHierarchy::Register(const std::string& uri,
-                                  RestApi::GetHandler handler)
+                                  RestApiGetCall::Handler handler)
   {
     RestApiPath path(uri);
     RegisterInternal(path, handler, 0);
   }
 
   void RestApiHierarchy::Register(const std::string& uri,
-                                  RestApi::PutHandler handler)
+                                  RestApiPutCall::Handler handler)
   {
     RestApiPath path(uri);
     RegisterInternal(path, handler, 0);
   }
 
   void RestApiHierarchy::Register(const std::string& uri,
-                                  RestApi::PostHandler handler)
+                                  RestApiPostCall::Handler handler)
   {
     RestApiPath path(uri);
     RegisterInternal(path, handler, 0);
   }
 
   void RestApiHierarchy::Register(const std::string& uri,
-                                  RestApi::DeleteHandler handler)
+                                  RestApiDeleteCall::Handler handler)
   {
     RestApiPath path(uri);
     RegisterInternal(path, handler, 0);
@@ -429,28 +429,28 @@
       }*/
   }
 
-  bool RestApiHierarchy::Handle(RestApi::GetCall& call,
+  bool RestApiHierarchy::Handle(RestApiGetCall& call,
                                 const UriComponents& uri)
   {
     RestApiPath::Components components;
     return LookupHandler(components, uri, GetCallback, 0, &call);
   }    
 
-  bool RestApiHierarchy::Handle(RestApi::PutCall& call,
+  bool RestApiHierarchy::Handle(RestApiPutCall& call,
                                 const UriComponents& uri)
   {
     RestApiPath::Components components;
     return LookupHandler(components, uri, PutCallback, 0, &call);
   }    
 
-  bool RestApiHierarchy::Handle(RestApi::PostCall& call,
+  bool RestApiHierarchy::Handle(RestApiPostCall& call,
                                 const UriComponents& uri)
   {
     RestApiPath::Components components;
     return LookupHandler(components, uri, PostCallback, 0, &call);
   }    
 
-  bool RestApiHierarchy::Handle(RestApi::DeleteCall& call,
+  bool RestApiHierarchy::Handle(RestApiDeleteCall& call,
                                 const UriComponents& uri)
   {
     RestApiPath::Components components;
--- a/Core/RestApi/RestApiHierarchy.h	Mon Jun 30 14:08:15 2014 +0200
+++ b/Core/RestApi/RestApiHierarchy.h	Mon Jun 30 14:44:05 2014 +0200
@@ -47,40 +47,40 @@
     class Handlers
     {
     private:
-      RestApi::GetHandler  getHandler_;
-      RestApi::PostHandler  postHandler_;
-      RestApi::PutHandler  putHandler_;
-      RestApi::DeleteHandler  deleteHandler_;
+      RestApiGetCall::Handler  getHandler_;
+      RestApiPostCall::Handler  postHandler_;
+      RestApiPutCall::Handler  putHandler_;
+      RestApiDeleteCall::Handler  deleteHandler_;
 
     public:
       Handlers();
 
       bool HasHandler(HttpMethod method) const;
 
-      RestApi::GetHandler GetGetHandler() const;
+      RestApiGetCall::Handler GetGetHandler() const;
 
-      RestApi::PutHandler GetPutHandler() const;
+      RestApiPutCall::Handler GetPutHandler() const;
 
-      RestApi::PostHandler GetPostHandler() const;
+      RestApiPostCall::Handler GetPostHandler() const;
 
-      RestApi::DeleteHandler GetDeleteHandler() const;
+      RestApiDeleteCall::Handler GetDeleteHandler() const;
 
-      void Register(RestApi::GetHandler handler)
+      void Register(RestApiGetCall::Handler handler)
       {
         getHandler_ = handler;
       }
 
-      void Register(RestApi::PutHandler handler)
+      void Register(RestApiPutCall::Handler handler)
       {
         putHandler_ = handler;
       }
 
-      void Register(RestApi::PostHandler handler)
+      void Register(RestApiPostCall::Handler handler)
       {
         postHandler_ = handler;
       }
 
-      void Register(RestApi::DeleteHandler handler)
+      void Register(RestApiDeleteCall::Handler handler)
       {
         deleteHandler_ = handler;
       }
@@ -151,16 +151,16 @@
     ~RestApiHierarchy();
 
     void Register(const std::string& uri,
-                  RestApi::GetHandler handler);
+                  RestApiGetCall::Handler handler);
 
     void Register(const std::string& uri,
-                  RestApi::PutHandler handler);
+                  RestApiPutCall::Handler handler);
 
     void Register(const std::string& uri,
-                  RestApi::PostHandler handler);
+                  RestApiPostCall::Handler handler);
 
     void Register(const std::string& uri,
-                  RestApi::DeleteHandler handler);
+                  RestApiDeleteCall::Handler handler);
 
     void CreateSiteMap(Json::Value& target) const;
 
@@ -170,16 +170,16 @@
       return GetDirectory(result, uri, 0);
     }
 
-    bool Handle(RestApi::GetCall& call,
+    bool Handle(RestApiGetCall& call,
                 const UriComponents& uri);
 
-    bool Handle(RestApi::PutCall& call,
+    bool Handle(RestApiPutCall& call,
                 const UriComponents& uri);
 
-    bool Handle(RestApi::PostCall& call,
+    bool Handle(RestApiPostCall& call,
                 const UriComponents& uri);
 
-    bool Handle(RestApi::DeleteCall& call,
+    bool Handle(RestApiDeleteCall& call,
                 const UriComponents& uri);
   };
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiPostCall.h	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,69 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "RestApiCall.h"
+
+namespace Orthanc
+{
+  class RestApiPostCall : public RestApiCall
+  {
+  private:
+    const std::string& data_;
+
+  public:
+    typedef void (*Handler) (RestApiPostCall& call);
+    
+    RestApiPostCall(RestApiOutput& output,
+                    RestApi& context,
+                    const HttpHandler::Arguments& httpHeaders,
+                    const RestApiPath::Components& uriComponents,
+                    const UriComponents& trailing,
+                    const UriComponents& fullUri,
+                    const std::string& data) :
+      RestApiCall(output, context, httpHeaders, uriComponents, trailing, fullUri),
+      data_(data)
+    {
+    }
+
+    const std::string& GetPostBody() const
+    {
+      return data_;
+    }
+
+    virtual bool ParseJsonRequest(Json::Value& result) const
+    {
+      return ParseJsonRequestInternal(result, GetPostBody().c_str());
+    }      
+  };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/RestApi/RestApiPutCall.h	Mon Jun 30 14:44:05 2014 +0200
@@ -0,0 +1,69 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
+ * Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+#include "RestApiCall.h"
+
+namespace Orthanc
+{
+  class RestApiPutCall : public RestApiCall
+  {
+  private:
+    const std::string& data_;
+
+  public:
+    typedef void (*Handler) (RestApiPutCall& call);
+    
+    RestApiPutCall(RestApiOutput& output,
+                   RestApi& context,
+                   const HttpHandler::Arguments& httpHeaders,
+                   const RestApiPath::Components& uriComponents,
+                   const UriComponents& trailing,
+                   const UriComponents& fullUri,
+                   const std::string& data) :
+      RestApiCall(output, context, httpHeaders, uriComponents, trailing, fullUri),
+      data_(data)
+    {
+    }
+
+    const std::string& GetPutBody() const
+    {
+      return data_;
+    }
+
+    virtual bool ParseJsonRequest(Json::Value& result) const
+    {
+      return ParseJsonRequestInternal(result, GetPutBody().c_str());
+    }      
+  };
+}
--- a/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -112,7 +112,7 @@
 
 
   static bool ParseModifyRequest(DicomModification& target,
-                                 const RestApi::PostCall& call)
+                                 const RestApiPostCall& call)
   {
     // curl http://localhost:8042/series/95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0/modify -X POST -d '{"Replace":{"InstitutionName":"My own clinic"}}'
 
@@ -144,7 +144,7 @@
 
 
   static bool ParseAnonymizationRequest(DicomModification& target,
-                                        RestApi::PostCall& call)
+                                        RestApiPostCall& call)
   {
     // curl http://localhost:8042/instances/6e67da51-d119d6ae-c5667437-87b9a8a5-0f07c49f/anonymize -X POST -d '{"Replace":{"PatientName":"hello","0010-0020":"world"},"Keep":["StudyDescription", "SeriesDescription"],"KeepPrivateTags": null,"Remove":["Modality"]}' > Anonymized.dcm
 
@@ -191,7 +191,7 @@
 
 
   static void AnonymizeOrModifyInstance(DicomModification& modification,
-                                        RestApi::PostCall& call)
+                                        RestApiPostCall& call)
   {
     std::string id = call.GetUriComponent("id", "");
 
@@ -207,7 +207,7 @@
                                         MetadataType metadataType,
                                         ChangeType changeType,
                                         ResourceType resourceType,
-                                        RestApi::PostCall& call)
+                                        RestApiPostCall& call)
   {
     bool isFirst = true;
     Json::Value result(Json::objectValue);
@@ -333,7 +333,7 @@
 
 
 
-  static void ModifyInstance(RestApi::PostCall& call)
+  static void ModifyInstance(RestApiPostCall& call)
   {
     DicomModification modification;
 
@@ -361,7 +361,7 @@
   }
 
 
-  static void AnonymizeInstance(RestApi::PostCall& call)
+  static void AnonymizeInstance(RestApiPostCall& call)
   {
     DicomModification modification;
 
@@ -374,7 +374,7 @@
 
   template <enum ChangeType changeType,
             enum ResourceType resourceType>
-  static void ModifyResource(RestApi::PostCall& call)
+  static void ModifyResource(RestApiPostCall& call)
   {
     DicomModification modification;
 
@@ -389,7 +389,7 @@
 
   template <enum ChangeType changeType,
             enum ResourceType resourceType>
-  static void AnonymizeResource(RestApi::PostCall& call)
+  static void AnonymizeResource(RestApiPostCall& call)
   {
     DicomModification modification;
 
@@ -401,7 +401,7 @@
   }
 
 
-  static void Create(RestApi::PostCall& call)
+  static void Create(RestApiPostCall& call)
   {
     // curl http://localhost:8042/tools/create-dicom -X POST -d '{"PatientName":"Hello^World"}'
     // curl http://localhost:8042/tools/create-dicom -X POST -d '{"PatientName":"Hello^World","PixelData":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gUGDDcB53FulQAAAElJREFUGNNtj0sSAEEEQ1+U+185s1CtmRkblQ9CZldsKHJDk6DLGLJa6chjh0ooQmpjXMM86zPwydGEj6Ed/UGykkEM8X+p3u8/8LcOJIWLGeMAAAAASUVORK5CYII="}'
--- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -39,9 +39,9 @@
 
 namespace Orthanc
 {
-  void OrthancRestApi::AnswerStoredInstance(RestApi::PostCall& call,
+  void OrthancRestApi::AnswerStoredInstance(RestApiPostCall& call,
                                             const std::string& publicId,
-                                            StoreStatus status)
+                                            StoreStatus status) const
   {
     Json::Value result = Json::objectValue;
 
@@ -59,7 +59,7 @@
 
   // Upload of DICOM files through HTTP ---------------------------------------
 
-  static void UploadDicomFile(RestApi::PostCall& call)
+  static void UploadDicomFile(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
--- a/OrthancServer/OrthancRestApi/OrthancRestApi.h	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestApi.h	Mon Jun 30 14:44:05 2014 +0200
@@ -62,23 +62,23 @@
   public:
     OrthancRestApi(ServerContext& context);
 
-    static OrthancRestApi& GetApi(RestApi::Call& call)
+    static OrthancRestApi& GetApi(RestApiCall& call)
     {
       return dynamic_cast<OrthancRestApi&>(call.GetContext());
     }
 
-    static ServerContext& GetContext(RestApi::Call& call)
+    static ServerContext& GetContext(RestApiCall& call)
     {
       return GetApi(call).context_;
     }
 
-    static ServerIndex& GetIndex(RestApi::Call& call)
+    static ServerIndex& GetIndex(RestApiCall& call)
     {
       return GetContext(call).GetIndex();
     }
 
-    void AnswerStoredInstance(RestApi::PostCall& call,
+    void AnswerStoredInstance(RestApiPostCall& call,
                               const std::string& publicId,
-                              StoreStatus status);
+                              StoreStatus status) const;
   };
 }
--- a/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestArchive.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -233,7 +233,7 @@
   }                                 
 
   template <enum ResourceType resourceType>
-  static void GetArchive(RestApi::GetCall& call)
+  static void GetArchive(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
--- a/OrthancServer/OrthancRestApi/OrthancRestChanges.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestChanges.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -42,7 +42,7 @@
   static void GetSinceAndLimit(int64_t& since,
                                unsigned int& limit,
                                bool& last,
-                               const RestApi::GetCall& call)
+                               const RestApiGetCall& call)
   {
     static const unsigned int MAX_RESULTS = 100;
     
@@ -70,7 +70,7 @@
     }
   }
 
-  static void GetChanges(RestApi::GetCall& call)
+  static void GetChanges(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -89,7 +89,7 @@
   }
 
 
-  static void DeleteChanges(RestApi::DeleteCall& call)
+  static void DeleteChanges(RestApiDeleteCall& call)
   {
     OrthancRestApi::GetIndex(call).DeleteChanges();
     call.GetOutput().AnswerBuffer("", "text/plain");
@@ -98,7 +98,7 @@
 
   // Exports API --------------------------------------------------------------
  
-  static void GetExports(RestApi::GetCall& call)
+  static void GetExports(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -116,7 +116,7 @@
   }
 
 
-  static void DeleteExports(RestApi::DeleteCall& call)
+  static void DeleteExports(RestApiDeleteCall& call)
   {
     OrthancRestApi::GetIndex(call).DeleteExportedResources();
     call.GetOutput().AnswerBuffer("", "text/plain");
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -65,7 +65,7 @@
     return true;
   }
 
-  static void DicomFindPatient(RestApi::PostCall& call)
+  static void DicomFindPatient(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -87,7 +87,7 @@
     call.GetOutput().AnswerJson(result);
   }
 
-  static void DicomFindStudy(RestApi::PostCall& call)
+  static void DicomFindStudy(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -115,7 +115,7 @@
     call.GetOutput().AnswerJson(result);
   }
 
-  static void DicomFindSeries(RestApi::PostCall& call)
+  static void DicomFindSeries(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -144,7 +144,7 @@
     call.GetOutput().AnswerJson(result);
   }
 
-  static void DicomFindInstance(RestApi::PostCall& call)
+  static void DicomFindInstance(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -174,7 +174,7 @@
     call.GetOutput().AnswerJson(result);
   }
 
-  static void DicomFind(RestApi::PostCall& call)
+  static void DicomFind(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -248,7 +248,7 @@
 
   static bool GetInstancesToExport(std::list<std::string>& instances,
                                    const std::string& remote,
-                                   RestApi::PostCall& call)
+                                   RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -308,7 +308,7 @@
   }
 
 
-  static void DicomStore(RestApi::PostCall& call)
+  static void DicomStore(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -345,7 +345,7 @@
     return peers.find(id) != peers.end();
   }
 
-  static void ListPeers(RestApi::GetCall& call)
+  static void ListPeers(RestApiGetCall& call)
   {
     OrthancRestApi::SetOfStrings peers;
     Configuration::GetListOfOrthancPeers(peers);
@@ -360,7 +360,7 @@
     call.GetOutput().AnswerJson(result);
   }
 
-  static void ListPeerOperations(RestApi::GetCall& call)
+  static void ListPeerOperations(RestApiGetCall& call)
   {
     OrthancRestApi::SetOfStrings peers;
     Configuration::GetListOfOrthancPeers(peers);
@@ -374,7 +374,7 @@
     }
   }
 
-  static void PeerStore(RestApi::PostCall& call)
+  static void PeerStore(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -429,7 +429,7 @@
     return modalities.find(id) != modalities.end();
   }
 
-  static void ListModalities(RestApi::GetCall& call)
+  static void ListModalities(RestApiGetCall& call)
   {
     OrthancRestApi::SetOfStrings modalities;
     Configuration::GetListOfDicomModalities(modalities);
@@ -445,7 +445,7 @@
   }
 
 
-  static void ListModalityOperations(RestApi::GetCall& call)
+  static void ListModalityOperations(RestApiGetCall& call)
   {
     OrthancRestApi::SetOfStrings modalities;
     Configuration::GetListOfDicomModalities(modalities);
@@ -465,7 +465,7 @@
   }
 
 
-  static void UpdateModality(RestApi::PutCall& call)
+  static void UpdateModality(RestApiPutCall& call)
   {
     Json::Value json;
     Json::Reader reader;
@@ -479,14 +479,14 @@
   }
 
 
-  static void DeleteModality(RestApi::DeleteCall& call)
+  static void DeleteModality(RestApiDeleteCall& call)
   {
     Configuration::RemoveModality(call.GetUriComponent("id", ""));
     call.GetOutput().AnswerBuffer("", "text/plain");
   }
 
 
-  static void UpdatePeer(RestApi::PutCall& call)
+  static void UpdatePeer(RestApiPutCall& call)
   {
     Json::Value json;
     Json::Reader reader;
@@ -500,7 +500,7 @@
   }
 
 
-  static void DeletePeer(RestApi::DeleteCall& call)
+  static void DeletePeer(RestApiDeleteCall& call)
   {
     Configuration::RemovePeer(call.GetUriComponent("id", ""));
     call.GetOutput().AnswerBuffer("", "text/plain");
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -43,7 +43,7 @@
   // List all the patients, studies, series or instances ----------------------
  
   template <enum ResourceType resourceType>
-  static void ListResources(RestApi::GetCall& call)
+  static void ListResources(RestApiGetCall& call)
   {
     Json::Value result;
     OrthancRestApi::GetIndex(call).GetAllUuids(result, resourceType);
@@ -51,7 +51,7 @@
   }
 
   template <enum ResourceType resourceType>
-  static void GetSingleResource(RestApi::GetCall& call)
+  static void GetSingleResource(RestApiGetCall& call)
   {
     Json::Value result;
     if (OrthancRestApi::GetIndex(call).LookupResource(result, call.GetUriComponent("id", ""), resourceType))
@@ -61,7 +61,7 @@
   }
 
   template <enum ResourceType resourceType>
-  static void DeleteSingleResource(RestApi::DeleteCall& call)
+  static void DeleteSingleResource(RestApiDeleteCall& call)
   {
     Json::Value result;
     if (OrthancRestApi::GetIndex(call).DeleteResource(result, call.GetUriComponent("id", ""), resourceType))
@@ -73,7 +73,7 @@
 
   // Get information about a single patient -----------------------------------
  
-  static void IsProtectedPatient(RestApi::GetCall& call)
+  static void IsProtectedPatient(RestApiGetCall& call)
   {
     std::string publicId = call.GetUriComponent("id", "");
     bool isProtected = OrthancRestApi::GetIndex(call).IsProtectedPatient(publicId);
@@ -81,7 +81,7 @@
   }
 
 
-  static void SetPatientProtection(RestApi::PutCall& call)
+  static void SetPatientProtection(RestApiPutCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -107,7 +107,7 @@
 
   // Get information about a single instance ----------------------------------
  
-  static void GetInstanceFile(RestApi::GetCall& call)
+  static void GetInstanceFile(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -116,7 +116,7 @@
   }
 
 
-  static void ExportInstanceFile(RestApi::PostCall& call)
+  static void ExportInstanceFile(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -132,7 +132,7 @@
 
 
   template <bool simplify>
-  static void GetInstanceTags(RestApi::GetCall& call)
+  static void GetInstanceTags(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -154,7 +154,7 @@
   }
 
 
-  static void GetInstanceTagsBis(RestApi::GetCall& call)
+  static void GetInstanceTagsBis(RestApiGetCall& call)
   {
     bool simplify = call.HasArgument("simplify");
 
@@ -169,7 +169,7 @@
   }
 
   
-  static void ListFrames(RestApi::GetCall& call)
+  static void ListFrames(RestApiGetCall& call)
   {
     Json::Value instance;
     if (OrthancRestApi::GetIndex(call).LookupResource(instance, call.GetUriComponent("id", ""), ResourceType_Instance))
@@ -197,7 +197,7 @@
 
 
   template <enum ImageExtractionMode mode>
-  static void GetImage(RestApi::GetCall& call)
+  static void GetImage(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -245,7 +245,7 @@
   }
 
 
-  static void GetMatlabImage(RestApi::GetCall& call)
+  static void GetMatlabImage(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -279,7 +279,7 @@
 
 
 
-  static void GetResourceStatistics(RestApi::GetCall& call)
+  static void GetResourceStatistics(RestApiGetCall& call)
   {
     std::string publicId = call.GetUriComponent("id", "");
     Json::Value result;
@@ -291,14 +291,14 @@
 
   // Handling of metadata -----------------------------------------------------
 
-  static void CheckValidResourceType(RestApi::Call& call)
+  static void CheckValidResourceType(RestApiCall& call)
   {
     std::string resourceType = call.GetUriComponent("resourceType", "");
     StringToResourceType(resourceType.c_str());
   }
 
 
-  static void ListMetadata(RestApi::GetCall& call)
+  static void ListMetadata(RestApiGetCall& call)
   {
     CheckValidResourceType(call);
     
@@ -318,7 +318,7 @@
   }
 
 
-  static void GetMetadata(RestApi::GetCall& call)
+  static void GetMetadata(RestApiGetCall& call)
   {
     CheckValidResourceType(call);
     
@@ -334,7 +334,7 @@
   }
 
 
-  static void DeleteMetadata(RestApi::DeleteCall& call)
+  static void DeleteMetadata(RestApiDeleteCall& call)
   {
     CheckValidResourceType(call);
 
@@ -352,7 +352,7 @@
   }
 
 
-  static void SetMetadata(RestApi::PutCall& call)
+  static void SetMetadata(RestApiPutCall& call)
   {
     CheckValidResourceType(call);
 
@@ -375,7 +375,7 @@
 
   // Handling of attached files -----------------------------------------------
 
-  static void ListAttachments(RestApi::GetCall& call)
+  static void ListAttachments(RestApiGetCall& call)
   {
     std::string resourceType = call.GetUriComponent("resourceType", "");
     std::string publicId = call.GetUriComponent("id", "");
@@ -394,7 +394,7 @@
   }
 
 
-  static bool GetAttachmentInfo(FileInfo& info, RestApi::Call& call)
+  static bool GetAttachmentInfo(FileInfo& info, RestApiCall& call)
   {
     CheckValidResourceType(call);
  
@@ -406,7 +406,7 @@
   }
 
 
-  static void GetAttachmentOperations(RestApi::GetCall& call)
+  static void GetAttachmentOperations(RestApiGetCall& call)
   {
     FileInfo info;
     if (GetAttachmentInfo(info, call))
@@ -442,7 +442,7 @@
 
   
   template <int uncompress>
-  static void GetAttachmentData(RestApi::GetCall& call)
+  static void GetAttachmentData(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
 
@@ -459,7 +459,7 @@
   }
 
 
-  static void GetAttachmentSize(RestApi::GetCall& call)
+  static void GetAttachmentSize(RestApiGetCall& call)
   {
     FileInfo info;
     if (GetAttachmentInfo(info, call))
@@ -469,7 +469,7 @@
   }
 
 
-  static void GetAttachmentCompressedSize(RestApi::GetCall& call)
+  static void GetAttachmentCompressedSize(RestApiGetCall& call)
   {
     FileInfo info;
     if (GetAttachmentInfo(info, call))
@@ -479,7 +479,7 @@
   }
 
 
-  static void GetAttachmentMD5(RestApi::GetCall& call)
+  static void GetAttachmentMD5(RestApiGetCall& call)
   {
     FileInfo info;
     if (GetAttachmentInfo(info, call) &&
@@ -490,7 +490,7 @@
   }
 
 
-  static void GetAttachmentCompressedMD5(RestApi::GetCall& call)
+  static void GetAttachmentCompressedMD5(RestApiGetCall& call)
   {
     FileInfo info;
     if (GetAttachmentInfo(info, call) &&
@@ -501,7 +501,7 @@
   }
 
 
-  static void VerifyAttachment(RestApi::PostCall& call)
+  static void VerifyAttachment(RestApiPostCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
     CheckValidResourceType(call);
@@ -555,7 +555,7 @@
   }
 
 
-  static void UploadAttachment(RestApi::PutCall& call)
+  static void UploadAttachment(RestApiPutCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
     CheckValidResourceType(call);
@@ -575,7 +575,7 @@
   }
 
 
-  static void DeleteAttachment(RestApi::DeleteCall& call)
+  static void DeleteAttachment(RestApiDeleteCall& call)
   {
     CheckValidResourceType(call);
 
@@ -595,7 +595,7 @@
 
   // Raw access to the DICOM tags of an instance ------------------------------
 
-  static void GetRawContent(RestApi::GetCall& call)
+  static void GetRawContent(RestApiGetCall& call)
   {
     std::string id = call.GetUriComponent("id", "");
 
@@ -681,7 +681,7 @@
   }
 
 
-  static void GetSharedTags(RestApi::GetCall& call)
+  static void GetSharedTags(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
     std::string publicId = call.GetUriComponent("id", "");
@@ -706,7 +706,7 @@
 
 
   template <enum ResourceType resourceType>
-  static void GetModule(RestApi::GetCall& call)
+  static void GetModule(RestApiGetCall& call)
   {
     ServerContext& context = OrthancRestApi::GetContext(call);
     std::string publicId = call.GetUriComponent("id", "");
--- a/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -43,12 +43,12 @@
 {
   // System information -------------------------------------------------------
 
-  static void ServeRoot(RestApi::GetCall& call)
+  static void ServeRoot(RestApiGetCall& call)
   {
     call.GetOutput().Redirect("app/explorer.html");
   }
  
-  static void GetSystemInformation(RestApi::GetCall& call)
+  static void GetSystemInformation(RestApiGetCall& call)
   {
     Json::Value result = Json::objectValue;
 
@@ -58,14 +58,14 @@
     call.GetOutput().AnswerJson(result);
   }
 
-  static void GetStatistics(RestApi::GetCall& call)
+  static void GetStatistics(RestApiGetCall& call)
   {
     Json::Value result = Json::objectValue;
     OrthancRestApi::GetIndex(call).ComputeStatistics(result);
     call.GetOutput().AnswerJson(result);
   }
 
-  static void GenerateUid(RestApi::GetCall& call)
+  static void GenerateUid(RestApiGetCall& call)
   {
     std::string level = call.GetArgument("level", "");
     if (level == "patient")
@@ -86,7 +86,7 @@
     }
   }
 
-  static void ExecuteScript(RestApi::PostCall& call)
+  static void ExecuteScript(RestApiPostCall& call)
   {
     std::string result;
     ServerContext& context = OrthancRestApi::GetContext(call);
@@ -94,7 +94,7 @@
     call.GetOutput().AnswerBuffer(result, "text/plain");
   }
 
-  static void GetNowIsoString(RestApi::GetCall& call)
+  static void GetNowIsoString(RestApiGetCall& call)
   {
     call.GetOutput().AnswerBuffer(Toolbox::GetNowIsoString(), "text/plain");
   }
--- a/UnitTestsSources/RestApiTests.cpp	Mon Jun 30 14:08:15 2014 +0200
+++ b/UnitTestsSources/RestApiTests.cpp	Mon Jun 30 14:44:05 2014 +0200
@@ -196,7 +196,7 @@
 static int testValue;
 
 template <int value>
-static void SetValue(RestApi::GetCall& get)
+static void SetValue(RestApiGetCall& get)
 {
   testValue = value;
 }
@@ -217,7 +217,7 @@
 {
   UriComponents p;
   Toolbox::SplitUriComponents(p, uri);
-  return hierarchy.Handle(*reinterpret_cast<RestApi::GetCall*>(NULL), p);
+  return hierarchy.Handle(*reinterpret_cast<RestApiGetCall*>(NULL), p);
 }