Mercurial > hg > orthanc
annotate OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp @ 4203:4d42408da117
improving const-correctness in ParsedDicomFile
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 17 Sep 2020 15:01:31 +0200 |
parents | bf7b9edf6b81 |
children | b30a8de92ad9 |
rev | line source |
---|---|
969 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1063
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
969 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
969 | 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 | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
969 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
969 | 20 **/ |
21 | |
22 | |
1624
0a2ad4a6858f
fix missing precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1444
diff
changeset
|
23 #include "../PrecompiledHeaders.h" |
969 | 24 #include "RestApiHierarchy.h" |
25 | |
975 | 26 #include "../OrthancException.h" |
27 | |
969 | 28 #include <cassert> |
1063
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
29 #include <stdio.h> |
969 | 30 |
31 namespace Orthanc | |
32 { | |
978 | 33 RestApiHierarchy::Resource::Resource() : |
972 | 34 getHandler_(NULL), |
35 postHandler_(NULL), | |
36 putHandler_(NULL), | |
37 deleteHandler_(NULL) | |
38 { | |
39 } | |
40 | |
41 | |
978 | 42 bool RestApiHierarchy::Resource::HasHandler(HttpMethod method) const |
972 | 43 { |
44 switch (method) | |
45 { | |
46 case HttpMethod_Get: | |
47 return getHandler_ != NULL; | |
48 | |
49 case HttpMethod_Post: | |
50 return postHandler_ != NULL; | |
51 | |
52 case HttpMethod_Put: | |
53 return putHandler_ != NULL; | |
54 | |
55 case HttpMethod_Delete: | |
56 return deleteHandler_ != NULL; | |
57 | |
58 default: | |
59 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
60 } | |
61 } | |
62 | |
63 | |
978 | 64 bool RestApiHierarchy::Resource::IsEmpty() const |
969 | 65 { |
972 | 66 return (getHandler_ == NULL && |
67 postHandler_ == NULL && | |
68 putHandler_ == NULL && | |
69 deleteHandler_ == NULL); | |
70 } | |
71 | |
72 | |
969 | 73 RestApiHierarchy& RestApiHierarchy::AddChild(Children& children, |
74 const std::string& name) | |
75 { | |
76 Children::iterator it = children.find(name); | |
77 | |
78 if (it == children.end()) | |
79 { | |
80 // Create new child | |
81 RestApiHierarchy *child = new RestApiHierarchy; | |
82 children[name] = child; | |
83 return *child; | |
84 } | |
85 else | |
86 { | |
87 return *it->second; | |
88 } | |
89 } | |
90 | |
91 | |
978 | 92 |
93 bool RestApiHierarchy::Resource::Handle(RestApiGetCall& call) const | |
94 { | |
95 if (getHandler_ != NULL) | |
96 { | |
97 getHandler_(call); | |
98 return true; | |
99 } | |
100 else | |
101 { | |
102 return false; | |
103 } | |
104 } | |
105 | |
106 | |
107 bool RestApiHierarchy::Resource::Handle(RestApiPutCall& call) const | |
108 { | |
109 if (putHandler_ != NULL) | |
110 { | |
111 putHandler_(call); | |
112 return true; | |
113 } | |
114 else | |
115 { | |
116 return false; | |
117 } | |
118 } | |
119 | |
120 | |
121 bool RestApiHierarchy::Resource::Handle(RestApiPostCall& call) const | |
122 { | |
123 if (postHandler_ != NULL) | |
124 { | |
125 postHandler_(call); | |
126 return true; | |
127 } | |
128 else | |
129 { | |
130 return false; | |
131 } | |
132 } | |
133 | |
134 | |
135 bool RestApiHierarchy::Resource::Handle(RestApiDeleteCall& call) const | |
136 { | |
137 if (deleteHandler_ != NULL) | |
138 { | |
139 deleteHandler_(call); | |
140 return true; | |
141 } | |
142 else | |
143 { | |
144 return false; | |
145 } | |
146 } | |
147 | |
148 | |
149 | |
969 | 150 void RestApiHierarchy::DeleteChildren(Children& children) |
151 { | |
152 for (Children::iterator it = children.begin(); | |
1303 | 153 it != children.end(); ++it) |
969 | 154 { |
155 delete it->second; | |
156 } | |
157 } | |
158 | |
159 | |
160 template <typename Handler> | |
161 void RestApiHierarchy::RegisterInternal(const RestApiPath& path, | |
162 Handler handler, | |
163 size_t level) | |
164 { | |
165 if (path.GetLevelCount() == level) | |
166 { | |
167 if (path.IsUniversalTrailing()) | |
168 { | |
169 universalHandlers_.Register(handler); | |
170 } | |
171 else | |
172 { | |
173 handlers_.Register(handler); | |
174 } | |
175 } | |
176 else | |
177 { | |
178 RestApiHierarchy* child; | |
179 if (path.IsWildcardLevel(level)) | |
180 { | |
181 child = &AddChild(wildcardChildren_, path.GetWildcardName(level)); | |
182 } | |
183 else | |
184 { | |
185 child = &AddChild(children_, path.GetLevelName(level)); | |
186 } | |
187 | |
188 child->RegisterInternal(path, handler, level + 1); | |
189 } | |
190 } | |
191 | |
192 | |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1303
diff
changeset
|
193 bool RestApiHierarchy::LookupResource(IHttpHandler::Arguments& components, |
969 | 194 const UriComponents& uri, |
978 | 195 IVisitor& visitor, |
196 size_t level) | |
969 | 197 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
198 if (uri.size() != 0 && |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
199 level > uri.size()) |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
200 { |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
201 return false; |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
202 } |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
203 |
969 | 204 UriComponents trailing; |
205 | |
206 // Look for an exact match on the resource of interest | |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
207 if (uri.size() == 0 || |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
208 level == uri.size()) |
969 | 209 { |
210 if (!handlers_.IsEmpty() && | |
978 | 211 visitor.Visit(handlers_, uri, components, trailing)) |
969 | 212 { |
213 return true; | |
214 } | |
215 } | |
216 | |
217 | |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
218 if (level < uri.size()) // A recursive call is possible |
969 | 219 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
220 // Try and go down in the hierarchy, using an exact match for the child |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
221 Children::const_iterator child = children_.find(uri[level]); |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
222 if (child != children_.end()) |
969 | 223 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
224 if (child->second->LookupResource(components, uri, visitor, level + 1)) |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
225 { |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
226 return true; |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
227 } |
969 | 228 } |
229 | |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
230 // Try and go down in the hierarchy, using wildcard rules for children |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
231 for (child = wildcardChildren_.begin(); |
1303 | 232 child != wildcardChildren_.end(); ++child) |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
233 { |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1303
diff
changeset
|
234 IHttpHandler::Arguments subComponents = components; |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
235 subComponents[child->first] = uri[level]; |
969 | 236 |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
237 if (child->second->LookupResource(subComponents, uri, visitor, level + 1)) |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
238 { |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
239 return true; |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
240 } |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
241 } |
969 | 242 } |
243 | |
244 | |
245 // As a last resort, call the universal handlers, if any | |
246 if (!universalHandlers_.IsEmpty()) | |
247 { | |
248 trailing.resize(uri.size() - level); | |
249 size_t pos = 0; | |
250 for (size_t i = level; i < uri.size(); i++, pos++) | |
251 { | |
252 trailing[pos] = uri[i]; | |
253 } | |
254 | |
255 assert(pos == trailing.size()); | |
256 | |
978 | 257 if (visitor.Visit(universalHandlers_, uri, components, trailing)) |
969 | 258 { |
259 return true; | |
260 } | |
261 } | |
262 | |
263 return false; | |
264 } | |
265 | |
266 | |
978 | 267 bool RestApiHierarchy::CanGenerateDirectory() const |
268 { | |
1063
0332e6e8c679
Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
980
diff
changeset
|
269 return (universalHandlers_.IsEmpty() && |
1303 | 270 wildcardChildren_.empty()); |
978 | 271 } |
272 | |
273 | |
969 | 274 bool RestApiHierarchy::GetDirectory(Json::Value& result, |
275 const UriComponents& uri, | |
276 size_t level) | |
277 { | |
278 if (uri.size() == level) | |
279 { | |
978 | 280 if (CanGenerateDirectory()) |
969 | 281 { |
282 result = Json::arrayValue; | |
283 | |
284 for (Children::const_iterator it = children_.begin(); | |
1303 | 285 it != children_.end(); ++it) |
969 | 286 { |
287 result.append(it->first); | |
288 } | |
289 | |
290 return true; | |
291 } | |
292 else | |
293 { | |
294 return false; | |
295 } | |
296 } | |
297 | |
298 Children::const_iterator child = children_.find(uri[level]); | |
299 if (child != children_.end()) | |
300 { | |
301 if (child->second->GetDirectory(result, uri, level + 1)) | |
302 { | |
303 return true; | |
304 } | |
305 } | |
306 | |
307 for (child = wildcardChildren_.begin(); | |
1303 | 308 child != wildcardChildren_.end(); ++child) |
969 | 309 { |
310 if (child->second->GetDirectory(result, uri, level + 1)) | |
311 { | |
312 return true; | |
313 } | |
314 } | |
315 | |
316 return false; | |
317 } | |
318 | |
319 | |
320 RestApiHierarchy::~RestApiHierarchy() | |
321 { | |
322 DeleteChildren(children_); | |
323 DeleteChildren(wildcardChildren_); | |
324 } | |
325 | |
970 | 326 void RestApiHierarchy::Register(const std::string& uri, |
974 | 327 RestApiGetCall::Handler handler) |
969 | 328 { |
970 | 329 RestApiPath path(uri); |
969 | 330 RegisterInternal(path, handler, 0); |
331 } | |
332 | |
970 | 333 void RestApiHierarchy::Register(const std::string& uri, |
974 | 334 RestApiPutCall::Handler handler) |
969 | 335 { |
970 | 336 RestApiPath path(uri); |
969 | 337 RegisterInternal(path, handler, 0); |
338 } | |
339 | |
970 | 340 void RestApiHierarchy::Register(const std::string& uri, |
974 | 341 RestApiPostCall::Handler handler) |
969 | 342 { |
970 | 343 RestApiPath path(uri); |
969 | 344 RegisterInternal(path, handler, 0); |
345 } | |
346 | |
970 | 347 void RestApiHierarchy::Register(const std::string& uri, |
974 | 348 RestApiDeleteCall::Handler handler) |
969 | 349 { |
970 | 350 RestApiPath path(uri); |
969 | 351 RegisterInternal(path, handler, 0); |
352 } | |
353 | |
354 void RestApiHierarchy::CreateSiteMap(Json::Value& target) const | |
355 { | |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
356 target = Json::objectValue; |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
357 |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
358 /*std::string s = " "; |
972 | 359 if (handlers_.HasHandler(HttpMethod_Get)) |
969 | 360 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
361 s += "GET "; |
969 | 362 } |
363 | |
972 | 364 if (handlers_.HasHandler(HttpMethod_Post)) |
969 | 365 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
366 s += "POST "; |
969 | 367 } |
368 | |
972 | 369 if (handlers_.HasHandler(HttpMethod_Put)) |
969 | 370 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
371 s += "PUT "; |
969 | 372 } |
373 | |
972 | 374 if (handlers_.HasHandler(HttpMethod_Delete)) |
969 | 375 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
376 s += "DELETE "; |
969 | 377 } |
378 | |
978 | 379 target = s;*/ |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
380 |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
381 for (Children::const_iterator it = children_.begin(); |
1303 | 382 it != children_.end(); ++it) |
969 | 383 { |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
384 it->second->CreateSiteMap(target[it->first]); |
969 | 385 } |
386 | |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
387 for (Children::const_iterator it = wildcardChildren_.begin(); |
1303 | 388 it != wildcardChildren_.end(); ++it) |
980
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
389 { |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
390 it->second->CreateSiteMap(target["<" + it->first + ">"]); |
f1ff2a2f06cd
use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
978
diff
changeset
|
391 } |
969 | 392 } |
393 | |
978 | 394 |
395 bool RestApiHierarchy::LookupResource(const UriComponents& uri, | |
396 IVisitor& visitor) | |
969 | 397 { |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1303
diff
changeset
|
398 IHttpHandler::Arguments components; |
978 | 399 return LookupResource(components, uri, visitor, 0); |
969 | 400 } |
401 | |
978 | 402 |
403 | |
404 namespace | |
405 { | |
406 // Anonymous namespace to avoid clashes between compilation modules | |
407 | |
408 class AcceptedMethodsVisitor : public RestApiHierarchy::IVisitor | |
409 { | |
410 private: | |
411 std::set<HttpMethod>& methods_; | |
412 | |
413 public: | |
4203
4d42408da117
improving const-correctness in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
414 explicit AcceptedMethodsVisitor(std::set<HttpMethod>& methods) : |
4d42408da117
improving const-correctness in ParsedDicomFile
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
415 methods_(methods) |
978 | 416 { |
417 } | |
418 | |
419 virtual bool Visit(const RestApiHierarchy::Resource& resource, | |
420 const UriComponents& uri, | |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1303
diff
changeset
|
421 const IHttpHandler::Arguments& components, |
978 | 422 const UriComponents& trailing) |
423 { | |
424 if (trailing.size() == 0) // Ignore universal handlers | |
425 { | |
426 if (resource.HasHandler(HttpMethod_Get)) | |
427 { | |
428 methods_.insert(HttpMethod_Get); | |
429 } | |
430 | |
431 if (resource.HasHandler(HttpMethod_Post)) | |
432 { | |
433 methods_.insert(HttpMethod_Post); | |
434 } | |
435 | |
436 if (resource.HasHandler(HttpMethod_Put)) | |
437 { | |
438 methods_.insert(HttpMethod_Put); | |
439 } | |
440 | |
441 if (resource.HasHandler(HttpMethod_Delete)) | |
442 { | |
443 methods_.insert(HttpMethod_Delete); | |
444 } | |
445 } | |
446 | |
447 return false; // Continue to check all the possible ways to access this URI | |
448 } | |
449 }; | |
450 } | |
451 | |
452 void RestApiHierarchy::GetAcceptedMethods(std::set<HttpMethod>& methods, | |
453 const UriComponents& uri) | |
969 | 454 { |
1441
f3672356c121
refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1303
diff
changeset
|
455 IHttpHandler::Arguments components; |
978 | 456 AcceptedMethodsVisitor visitor(methods); |
1444
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
457 if (LookupResource(components, uri, visitor, 0)) |
978 | 458 { |
1444
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
459 Json::Value d; |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
460 if (GetDirectory(d, uri)) |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
461 { |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
462 methods.insert(HttpMethod_Get); |
b2b09a3dbd8e
refactoring: OrthancHttpHandler inside OrthancServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1441
diff
changeset
|
463 } |
978 | 464 } |
465 } | |
969 | 466 } |