comparison OrthancFramework/Sources/HttpServer/HttpToolbox.h @ 4330:a01b1c9cbef4

moving generic type definitions from IHttpHandler to HttpToolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2020 14:39:10 +0100
parents 9dc0e42f868b
children 17d209a3f397
comparison
equal deleted inserted replaced
4329:9dc0e42f868b 4330:a01b1c9cbef4
20 **/ 20 **/
21 21
22 22
23 #pragma once 23 #pragma once
24 24
25 #if !defined(ORTHANC_SANDBOXED)
26 # error Macro ORTHANC_SANDBOXED must be defined
27 #endif
28
29 #include "../Compatibility.h"
25 #include "../OrthancFramework.h" 30 #include "../OrthancFramework.h"
26 #include "IHttpHandler.h" 31 #include "../Toolbox.h"
32
33 #include <boost/noncopyable.hpp>
34 #include <map>
35 #include <vector>
27 36
28 namespace Orthanc 37 namespace Orthanc
29 { 38 {
39 class IHttpHandler;
40
30 class ORTHANC_PUBLIC HttpToolbox : public boost::noncopyable 41 class ORTHANC_PUBLIC HttpToolbox : public boost::noncopyable
31 { 42 {
32 public: 43 public:
33 static void ParseGetArguments(IHttpHandler::GetArguments& result, 44 typedef std::map<std::string, std::string> Arguments;
45 typedef std::vector< std::pair<std::string, std::string> > GetArguments;
46
47 static void ParseGetArguments(GetArguments& result,
34 const char* query); 48 const char* query);
35 49
36 static void ParseGetQuery(UriComponents& uri, 50 static void ParseGetQuery(UriComponents& uri,
37 IHttpHandler::GetArguments& getArguments, 51 GetArguments& getArguments,
38 const char* query); 52 const char* query);
39 53
40 static std::string GetArgument(const IHttpHandler::Arguments& getArguments, 54 static std::string GetArgument(const Arguments& getArguments,
41 const std::string& name, 55 const std::string& name,
42 const std::string& defaultValue); 56 const std::string& defaultValue);
43 57
44 static std::string GetArgument(const IHttpHandler::GetArguments& getArguments, 58 static std::string GetArgument(const GetArguments& getArguments,
45 const std::string& name, 59 const std::string& name,
46 const std::string& defaultValue); 60 const std::string& defaultValue);
47 61
48 static void ParseCookies(IHttpHandler::Arguments& result, 62 static void ParseCookies(Arguments& result,
49 const IHttpHandler::Arguments& httpHeaders); 63 const Arguments& httpHeaders);
50 64
51 static void CompileGetArguments(IHttpHandler::Arguments& compiled, 65 static void CompileGetArguments(Arguments& compiled,
52 const IHttpHandler::GetArguments& source); 66 const GetArguments& source);
67
68 #if ORTHANC_SANDBOXED != 1
69 ORTHANC_DEPRECATED
70 static bool SimpleGet(std::string& result,
71 IHttpHandler& handler,
72 RequestOrigin origin,
73 const std::string& uri,
74 const Arguments& httpHeaders);
75 #endif
76
77 #if ORTHANC_SANDBOXED != 1
78 ORTHANC_DEPRECATED
79 static bool SimplePost(std::string& result,
80 IHttpHandler& handler,
81 RequestOrigin origin,
82 const std::string& uri,
83 const void* bodyData,
84 size_t bodySize,
85 const Arguments& httpHeaders);
86 #endif
87
88 #if ORTHANC_SANDBOXED != 1
89 ORTHANC_DEPRECATED
90 static bool SimplePut(std::string& result,
91 IHttpHandler& handler,
92 RequestOrigin origin,
93 const std::string& uri,
94 const void* bodyData,
95 size_t bodySize,
96 const Arguments& httpHeaders);
97 #endif
98
99 #if ORTHANC_SANDBOXED != 1
100 ORTHANC_DEPRECATED
101 static bool SimpleDelete(IHttpHandler& handler,
102 RequestOrigin origin,
103 const std::string& uri,
104 const Arguments& httpHeaders);
105 #endif
53 }; 106 };
54 } 107 }