Mercurial > hg > orthanc
comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4329:9dc0e42f868b
moving static methods from HttpToolbox to IHttpHandler
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Nov 2020 13:46:49 +0100 |
parents | cb9aef006229 |
children | a01b1c9cbef4 |
comparison
equal
deleted
inserted
replaced
4328:ce9284aebd40 | 4329:9dc0e42f868b |
---|---|
2396 } | 2396 } |
2397 | 2397 |
2398 std::map<std::string, std::string> httpHeaders; | 2398 std::map<std::string, std::string> httpHeaders; |
2399 | 2399 |
2400 std::string result; | 2400 std::string result; |
2401 if (HttpToolbox::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, httpHeaders)) | 2401 if (IHttpHandler::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, httpHeaders)) |
2402 { | 2402 { |
2403 CopyToMemoryBuffer(*p.target, result); | 2403 CopyToMemoryBuffer(*p.target, result); |
2404 } | 2404 } |
2405 else | 2405 else |
2406 { | 2406 { |
2432 PImpl::ServerContextLock lock(*pimpl_); | 2432 PImpl::ServerContextLock lock(*pimpl_); |
2433 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!p.afterPlugins); | 2433 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!p.afterPlugins); |
2434 } | 2434 } |
2435 | 2435 |
2436 std::string result; | 2436 std::string result; |
2437 if (HttpToolbox::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, headers)) | 2437 if (IHttpHandler::SimpleGet(result, *handler, RequestOrigin_Plugins, p.uri, headers)) |
2438 { | 2438 { |
2439 CopyToMemoryBuffer(*p.target, result); | 2439 CopyToMemoryBuffer(*p.target, result); |
2440 } | 2440 } |
2441 else | 2441 else |
2442 { | 2442 { |
2464 | 2464 |
2465 std::map<std::string, std::string> httpHeaders; | 2465 std::map<std::string, std::string> httpHeaders; |
2466 | 2466 |
2467 std::string result; | 2467 std::string result; |
2468 if (isPost ? | 2468 if (isPost ? |
2469 HttpToolbox::SimplePost(result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders) : | 2469 IHttpHandler::SimplePost(result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders) : |
2470 HttpToolbox::SimplePut (result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders)) | 2470 IHttpHandler::SimplePut (result, *handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize, httpHeaders)) |
2471 { | 2471 { |
2472 CopyToMemoryBuffer(*p.target, result); | 2472 CopyToMemoryBuffer(*p.target, result); |
2473 } | 2473 } |
2474 else | 2474 else |
2475 { | 2475 { |
2492 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); | 2492 handler = &lock.GetContext().GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins); |
2493 } | 2493 } |
2494 | 2494 |
2495 std::map<std::string, std::string> httpHeaders; | 2495 std::map<std::string, std::string> httpHeaders; |
2496 | 2496 |
2497 if (!HttpToolbox::SimpleDelete(*handler, RequestOrigin_Plugins, uri, httpHeaders)) | 2497 if (!IHttpHandler::SimpleDelete(*handler, RequestOrigin_Plugins, uri, httpHeaders)) |
2498 { | 2498 { |
2499 throw OrthancException(ErrorCode_UnknownResource); | 2499 throw OrthancException(ErrorCode_UnknownResource); |
2500 } | 2500 } |
2501 } | 2501 } |
2502 | 2502 |