Mercurial > hg > orthanc-stone
annotate Framework/Deprecated/Toolbox/OrthancApiClient.cpp @ 891:0aff28f15ea2
new abstraction: IViewport
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jul 2019 18:18:42 +0200 |
parents | 4fe4b221a31f |
children | debb70fa10b5 |
rev | line source |
---|---|
270 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
270 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 #include "OrthancApiClient.h" | |
22 | |
792
4fe4b221a31f
deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
23 #include "../Toolbox/MessagingToolbox.h" |
270 | 24 |
377 | 25 #include <Core/OrthancException.h> |
270 | 26 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
27 namespace Deprecated |
377 | 28 { |
29 const Orthanc::IDynamicObject& OrthancApiClient::JsonResponseReadyMessage::GetPayload() const | |
30 { | |
31 if (HasPayload()) | |
32 { | |
33 return *payload_; | |
34 } | |
35 else | |
36 { | |
37 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
38 } | |
39 } | |
40 | |
41 | |
42 const Orthanc::IDynamicObject& OrthancApiClient::BinaryResponseReadyMessage::GetPayload() const | |
43 { | |
44 if (HasPayload()) | |
45 { | |
46 return *payload_; | |
47 } | |
48 else | |
49 { | |
50 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
51 } | |
52 } | |
53 | |
54 | |
55 const Orthanc::IDynamicObject& OrthancApiClient::EmptyResponseReadyMessage::GetPayload() const | |
56 { | |
57 if (HasPayload()) | |
58 { | |
59 return *payload_; | |
60 } | |
61 else | |
62 { | |
63 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | |
64 } | |
65 } | |
66 | |
67 | |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
68 class OrthancApiClient::WebServicePayload : public Orthanc::IDynamicObject |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
69 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
70 private: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
71 std::auto_ptr< OrthancStone::MessageHandler<EmptyResponseReadyMessage> > emptyHandler_; |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
72 std::auto_ptr< OrthancStone::MessageHandler<JsonResponseReadyMessage> > jsonHandler_; |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
73 std::auto_ptr< OrthancStone::MessageHandler<BinaryResponseReadyMessage> > binaryHandler_; |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
74 std::auto_ptr< OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage> > failureHandler_; |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
75 std::auto_ptr< Orthanc::IDynamicObject > userPayload_; |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
76 |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
77 void NotifyConversionError(const IWebService::HttpRequestSuccessMessage& message) const |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
78 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
79 if (failureHandler_.get() != NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
80 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
81 failureHandler_->Apply(IWebService::HttpRequestErrorMessage |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
82 (message.GetUri(), userPayload_.get())); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
83 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
84 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
85 |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
86 public: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
87 WebServicePayload(OrthancStone::MessageHandler<EmptyResponseReadyMessage>* handler, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
88 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureHandler, |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
89 Orthanc::IDynamicObject* userPayload) : |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
90 emptyHandler_(handler), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
91 failureHandler_(failureHandler), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
92 userPayload_(userPayload) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
93 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
94 if (handler == NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
95 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
96 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
97 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
98 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
99 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
100 WebServicePayload(OrthancStone::MessageHandler<BinaryResponseReadyMessage>* handler, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
101 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureHandler, |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
102 Orthanc::IDynamicObject* userPayload) : |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
103 binaryHandler_(handler), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
104 failureHandler_(failureHandler), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
105 userPayload_(userPayload) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
106 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
107 if (handler == NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
108 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
109 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
110 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
111 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
112 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
113 WebServicePayload(OrthancStone::MessageHandler<JsonResponseReadyMessage>* handler, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
114 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureHandler, |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
115 Orthanc::IDynamicObject* userPayload) : |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
116 jsonHandler_(handler), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
117 failureHandler_(failureHandler), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
118 userPayload_(userPayload) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
119 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
120 if (handler == NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
121 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
122 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
123 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
124 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
125 |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
126 void HandleSuccess(const IWebService::HttpRequestSuccessMessage& message) const |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
127 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
128 if (emptyHandler_.get() != NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
129 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
130 emptyHandler_->Apply(OrthancApiClient::EmptyResponseReadyMessage |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
131 (message.GetUri(), userPayload_.get())); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
132 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
133 else if (binaryHandler_.get() != NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
134 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
135 binaryHandler_->Apply(OrthancApiClient::BinaryResponseReadyMessage |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
136 (message.GetUri(), message.GetAnswer(), |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
137 message.GetAnswerSize(), userPayload_.get())); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
138 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
139 else if (jsonHandler_.get() != NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
140 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
141 Json::Value response; |
792
4fe4b221a31f
deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
142 if (MessagingToolbox::ParseJson(response, message.GetAnswer(), message.GetAnswerSize())) |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
143 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
144 jsonHandler_->Apply(OrthancApiClient::JsonResponseReadyMessage |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
145 (message.GetUri(), response, userPayload_.get())); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
146 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
147 else |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
148 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
149 NotifyConversionError(message); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
150 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
151 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
152 else |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
153 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
154 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
155 } |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
156 } |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
157 |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
158 void HandleFailure(const IWebService::HttpRequestErrorMessage& message) const |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
159 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
160 if (failureHandler_.get() != NULL) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
161 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
162 failureHandler_->Apply(IWebService::HttpRequestErrorMessage |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
163 (message.GetUri(), userPayload_.get())); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
164 } |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
165 } |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
166 }; |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
167 |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
168 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
169 OrthancApiClient::OrthancApiClient(OrthancStone::MessageBroker& broker, |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
170 IWebService& web, |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
171 const std::string& baseUrl) : |
377 | 172 IObservable(broker), |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
173 IObserver(broker), |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
174 web_(web), |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
175 baseUrl_(baseUrl) |
270 | 176 { |
177 } | |
178 | |
334
c34784e5f299
compatibility fixes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
315
diff
changeset
|
179 |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
180 void OrthancApiClient::GetJsonAsync( |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
181 const std::string& uri, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
182 OrthancStone::MessageHandler<JsonResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
183 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
184 Orthanc::IDynamicObject* payload) |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
185 { |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
186 IWebService::HttpHeaders emptyHeaders; |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
187 web_.GetAsync(baseUrl_ + uri, |
434
3a8bcc45c221
moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
430
diff
changeset
|
188 emptyHeaders, |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
189 new WebServicePayload(successCallback, failureCallback, payload), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
190 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestSuccessMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
191 (*this, &OrthancApiClient::NotifyHttpSuccess), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
192 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestErrorMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
193 (*this, &OrthancApiClient::NotifyHttpError)); |
299
3897f9f28cfa
backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
271
diff
changeset
|
194 } |
3897f9f28cfa
backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
271
diff
changeset
|
195 |
382
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
196 |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
197 void OrthancApiClient::GetBinaryAsync( |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
198 const std::string& uri, |
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
199 const std::string& contentType, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
200 OrthancStone::MessageHandler<BinaryResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
201 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
202 Orthanc::IDynamicObject* payload) |
382
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
203 { |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
204 IWebService::HttpHeaders headers; |
382
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
205 headers["Accept"] = contentType; |
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
206 GetBinaryAsync(uri, headers, successCallback, failureCallback, payload); |
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
207 } |
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
208 |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
209 void OrthancApiClient::GetBinaryAsync( |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
210 const std::string& uri, |
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
211 const IWebService::HttpHeaders& headers, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
212 OrthancStone::MessageHandler<BinaryResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
213 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
214 Orthanc::IDynamicObject* payload) |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
215 { |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
216 // printf("GET [%s] [%s]\n", baseUrl_.c_str(), uri.c_str()); |
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
217 |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
218 web_.GetAsync(baseUrl_ + uri, headers, |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
219 new WebServicePayload(successCallback, failureCallback, payload), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
220 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestSuccessMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
221 (*this, &OrthancApiClient::NotifyHttpSuccess), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
222 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestErrorMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
223 (*this, &OrthancApiClient::NotifyHttpError)); |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
224 } |
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
225 |
382
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
226 |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
227 void OrthancApiClient::PostBinaryAsyncExpectJson( |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
228 const std::string& uri, |
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
229 const std::string& body, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
230 OrthancStone::MessageHandler<JsonResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
231 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
232 Orthanc::IDynamicObject* payload) |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
233 { |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
234 web_.PostAsync(baseUrl_ + uri, IWebService::HttpHeaders(), body, |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
235 new WebServicePayload(successCallback, failureCallback, payload), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
236 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestSuccessMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
237 (*this, &OrthancApiClient::NotifyHttpSuccess), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
238 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestErrorMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
239 (*this, &OrthancApiClient::NotifyHttpError)); |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
240 |
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
241 } |
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
242 |
424
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
243 void OrthancApiClient::PostBinaryAsync( |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
244 const std::string& uri, |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
245 const std::string& body) |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
246 { |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
247 web_.PostAsync(baseUrl_ + uri, IWebService::HttpHeaders(), body, NULL, NULL, NULL); |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
248 } |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
249 |
502 | 250 void OrthancApiClient::PostBinaryAsync( |
251 const std::string& uri, | |
252 const std::string& body, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
253 OrthancStone::MessageHandler<EmptyResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
254 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
502 | 255 Orthanc::IDynamicObject* payload /* takes ownership */) |
256 { | |
257 web_.PostAsync(baseUrl_ + uri, IWebService::HttpHeaders(), body, | |
258 new WebServicePayload(successCallback, failureCallback, payload), | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
259 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestSuccessMessage> |
502 | 260 (*this, &OrthancApiClient::NotifyHttpSuccess), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
261 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestErrorMessage> |
502 | 262 (*this, &OrthancApiClient::NotifyHttpError)); |
263 } | |
264 | |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
265 void OrthancApiClient::PostJsonAsyncExpectJson( |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
266 const std::string& uri, |
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
267 const Json::Value& data, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
268 OrthancStone::MessageHandler<JsonResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
269 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
270 Orthanc::IDynamicObject* payload) |
309 | 271 { |
272 std::string body; | |
792
4fe4b221a31f
deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
273 MessagingToolbox::JsonToString(body, data); |
309 | 274 return PostBinaryAsyncExpectJson(uri, body, successCallback, failureCallback, payload); |
275 } | |
276 | |
424
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
277 void OrthancApiClient::PostJsonAsync( |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
278 const std::string& uri, |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
279 const Json::Value& data) |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
280 { |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
281 std::string body; |
792
4fe4b221a31f
deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
282 MessagingToolbox::JsonToString(body, data); |
424
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
283 return PostBinaryAsync(uri, body); |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
284 } |
bb573a52fc63
allow POST messages with success and failure handlers
am@osimis.io
parents:
422
diff
changeset
|
285 |
502 | 286 void OrthancApiClient::PostJsonAsync( |
287 const std::string& uri, | |
288 const Json::Value& data, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
289 OrthancStone::MessageHandler<EmptyResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
290 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
502 | 291 Orthanc::IDynamicObject* payload /* takes ownership */) |
292 { | |
293 std::string body; | |
792
4fe4b221a31f
deprecating MessagingToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
732
diff
changeset
|
294 MessagingToolbox::JsonToString(body, data); |
502 | 295 return PostBinaryAsync(uri, body, successCallback, failureCallback, payload); |
296 } | |
297 | |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
298 void OrthancApiClient::DeleteAsync( |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
299 const std::string& uri, |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
300 OrthancStone::MessageHandler<EmptyResponseReadyMessage>* successCallback, |
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
301 OrthancStone::MessageHandler<IWebService::HttpRequestErrorMessage>* failureCallback, |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
302 Orthanc::IDynamicObject* payload) |
315
aad37d0b6407
Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents:
309
diff
changeset
|
303 { |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
304 web_.DeleteAsync(baseUrl_ + uri, IWebService::HttpHeaders(), |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
305 new WebServicePayload(successCallback, failureCallback, payload), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
306 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestSuccessMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
307 (*this, &OrthancApiClient::NotifyHttpSuccess), |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
502
diff
changeset
|
308 new OrthancStone::Callable<OrthancApiClient, IWebService::HttpRequestErrorMessage> |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
383
diff
changeset
|
309 (*this, &OrthancApiClient::NotifyHttpError)); |
315
aad37d0b6407
Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents:
309
diff
changeset
|
310 } |
aad37d0b6407
Added LayerWidget::RemoveLayer + DELETE commands in WebService
am@osimis.io
parents:
309
diff
changeset
|
311 |
300
b4abaeb783b1
messaging refactoring almost complete: works fine in native
am@osimis.io
parents:
299
diff
changeset
|
312 |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
313 void OrthancApiClient::NotifyHttpSuccess(const IWebService::HttpRequestSuccessMessage& message) |
382
dd4c7e82b4be
removed class OrthancApiClient::HttpErrorMessage, redundant with IWebService::HttpRequestErrorMessage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
377
diff
changeset
|
314 { |
383
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
315 if (message.HasPayload()) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
316 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
317 dynamic_cast<const WebServicePayload&>(message.GetPayload()).HandleSuccess(message); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
318 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
319 else |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
320 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
321 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
322 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
323 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
324 |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
325 void OrthancApiClient::NotifyHttpError(const IWebService::HttpRequestErrorMessage& message) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
326 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
327 if (message.HasPayload()) |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
328 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
329 dynamic_cast<const WebServicePayload&>(message.GetPayload()).HandleFailure(message); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
330 } |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
331 else |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
332 { |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
333 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
939f626eb6d7
removing converters in OrthancApiClient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
334 } |
422
4fe42ae3653a
introduced a basic cache at OrthancApiClient level so it can be used with the RadiographyScene
am@osimis.io
parents:
418
diff
changeset
|
335 } |
270 | 336 } |