Mercurial > hg > orthanc
comparison Core/RestApi/RestApiCall.h @ 1571:3232f1c995a5
provide the origin of the requests to HTTP handlers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 Aug 2015 11:04:19 +0200 |
parents | f3672356c121 |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1570:2bd2c280f9b5 | 1571:3232f1c995a5 |
---|---|
46 class RestApiCall : public boost::noncopyable | 46 class RestApiCall : public boost::noncopyable |
47 { | 47 { |
48 private: | 48 private: |
49 RestApiOutput& output_; | 49 RestApiOutput& output_; |
50 RestApi& context_; | 50 RestApi& context_; |
51 RequestOrigin origin_; | |
52 const char* remoteIp_; | |
53 const char* username_; | |
51 const IHttpHandler::Arguments& httpHeaders_; | 54 const IHttpHandler::Arguments& httpHeaders_; |
52 const IHttpHandler::Arguments& uriComponents_; | 55 const IHttpHandler::Arguments& uriComponents_; |
53 const UriComponents& trailing_; | 56 const UriComponents& trailing_; |
54 const UriComponents& fullUri_; | 57 const UriComponents& fullUri_; |
55 | 58 |
58 const char* request); | 61 const char* request); |
59 | 62 |
60 public: | 63 public: |
61 RestApiCall(RestApiOutput& output, | 64 RestApiCall(RestApiOutput& output, |
62 RestApi& context, | 65 RestApi& context, |
66 RequestOrigin origin, | |
67 const char* remoteIp, | |
68 const char* username, | |
63 const IHttpHandler::Arguments& httpHeaders, | 69 const IHttpHandler::Arguments& httpHeaders, |
64 const IHttpHandler::Arguments& uriComponents, | 70 const IHttpHandler::Arguments& uriComponents, |
65 const UriComponents& trailing, | 71 const UriComponents& trailing, |
66 const UriComponents& fullUri) : | 72 const UriComponents& fullUri) : |
67 output_(output), | 73 output_(output), |
68 context_(context), | 74 context_(context), |
75 origin_(origin), | |
76 remoteIp_(remoteIp), | |
77 username_(username), | |
69 httpHeaders_(httpHeaders), | 78 httpHeaders_(httpHeaders), |
70 uriComponents_(uriComponents), | 79 uriComponents_(uriComponents), |
71 trailing_(trailing), | 80 trailing_(trailing), |
72 fullUri_(fullUri) | 81 fullUri_(fullUri) |
73 { | 82 { |
115 HttpToolbox::ParseCookies(result, httpHeaders_); | 124 HttpToolbox::ParseCookies(result, httpHeaders_); |
116 } | 125 } |
117 | 126 |
118 std::string FlattenUri() const; | 127 std::string FlattenUri() const; |
119 | 128 |
129 RequestOrigin GetRequestOrigin() const | |
130 { | |
131 return origin_; | |
132 } | |
133 | |
134 const char* GetRemoteIp() const | |
135 { | |
136 return remoteIp_; | |
137 } | |
138 | |
139 const char* GetUsername() const | |
140 { | |
141 return username_; | |
142 } | |
143 | |
120 virtual bool ParseJsonRequest(Json::Value& result) const = 0; | 144 virtual bool ParseJsonRequest(Json::Value& result) const = 0; |
121 }; | 145 }; |
122 } | 146 } |