comparison 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
comparison
equal deleted inserted replaced
1134:87fbeb823375 1135:a0a33e5ea5bb
34 class HttpCommand : public OracleCommandBase 34 class HttpCommand : public OracleCommandBase
35 { 35 {
36 public: 36 public:
37 typedef std::map<std::string, std::string> HttpHeaders; 37 typedef std::map<std::string, std::string> HttpHeaders;
38 38
39 class SuccessMessage : public OracleMessageBase 39 class SuccessMessage : public OriginMessage<HttpCommand>
40 { 40 {
41 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); 41 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__);
42 42
43 private: 43 private:
44 const HttpHeaders& headers_; 44 const HttpHeaders& headers_;
45 const std::string& answer_; 45 const std::string& answer_;
46 46
47 public: 47 public:
48 SuccessMessage(HttpCommand& command, 48 SuccessMessage(const HttpCommand& command,
49 const HttpHeaders& answerHeaders, 49 const HttpHeaders& answerHeaders,
50 const std::string& answer); 50 const std::string& answer) :
51 OriginMessage(command),
52 headers_(answerHeaders),
53 answer_(answer)
54 {
55 }
51 56
52 const std::string& GetAnswer() const 57 const std::string& GetAnswer() const
53 { 58 {
54 return answer_; 59 return answer_;
55 } 60 }
70 HttpHeaders headers_; 75 HttpHeaders headers_;
71 unsigned int timeout_; 76 unsigned int timeout_;
72 std::string username_; 77 std::string username_;
73 std::string password_; 78 std::string password_;
74 79
80 HttpCommand(const HttpCommand& other) :
81 method_(other.method_),
82 url_(other.url_),
83 body_(other.body_),
84 headers_(other.headers_),
85 timeout_(other.timeout_),
86 username_(other.username_),
87 password_(other.password_)
88 {
89 }
90
75 public: 91 public:
76 HttpCommand(); 92 HttpCommand();
77 93
78 virtual Type GetType() const 94 virtual Type GetType() const
79 { 95 {
80 return Type_Http; 96 return Type_Http;
97 }
98
99 virtual IOracleCommand* Clone() const
100 {
101 return new HttpCommand(*this);
81 } 102 }
82 103
83 void SetMethod(Orthanc::HttpMethod method) 104 void SetMethod(Orthanc::HttpMethod method)
84 { 105 {
85 method_ = method; 106 method_ = method;