diff Framework/Oracle/HttpCommand.h @ 1135:a0a33e5ea5bb broker

IOracleCommand::Clone()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 06 Nov 2019 17:34:58 +0100
parents 87fbeb823375
children 0ca50d275b9a
line wrap: on
line diff
--- a/Framework/Oracle/HttpCommand.h	Wed Nov 06 15:16:45 2019 +0100
+++ b/Framework/Oracle/HttpCommand.h	Wed Nov 06 17:34:58 2019 +0100
@@ -36,7 +36,7 @@
   public:
     typedef std::map<std::string, std::string>  HttpHeaders;
 
-    class SuccessMessage : public OracleMessageBase
+    class SuccessMessage : public OriginMessage<HttpCommand>
     {
       ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
       
@@ -45,9 +45,14 @@
       const std::string&  answer_;
 
     public:
-      SuccessMessage(HttpCommand& command,
+      SuccessMessage(const HttpCommand& command,
                      const HttpHeaders& answerHeaders,
-                     const std::string& answer);
+                     const std::string& answer) :
+        OriginMessage(command),
+        headers_(answerHeaders),
+        answer_(answer)
+      {
+      }
 
       const std::string& GetAnswer() const
       {
@@ -72,6 +77,17 @@
     std::string          username_;
     std::string          password_;
 
+    HttpCommand(const HttpCommand& other) :
+      method_(other.method_),
+      url_(other.url_),
+      body_(other.body_),
+      headers_(other.headers_),
+      timeout_(other.timeout_),
+      username_(other.username_),
+      password_(other.password_)
+    {
+    }
+
   public:
     HttpCommand();
 
@@ -80,6 +96,11 @@
       return Type_Http;
     }
 
+    virtual IOracleCommand* Clone() const
+    {
+      return new HttpCommand(*this);
+    }
+
     void SetMethod(Orthanc::HttpMethod method)
     {
       method_ = method;