Mercurial > hg > orthanc
comparison Core/RestApi/RestApi.cpp @ 659:443cced10836
code cleaning
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Nov 2013 14:41:46 +0100 |
parents | 08eca5d86aad |
children | 2d0a347e8cfc |
comparison
equal
deleted
inserted
replaced
658:e8e59e80868c | 659:443cced10836 |
---|---|
49 bool RestApi::GetCall::ParseJsonRequest(Json::Value& result) const | 49 bool RestApi::GetCall::ParseJsonRequest(Json::Value& result) const |
50 { | 50 { |
51 result.clear(); | 51 result.clear(); |
52 | 52 |
53 for (HttpHandler::Arguments::const_iterator | 53 for (HttpHandler::Arguments::const_iterator |
54 it = getArguments_->begin(); it != getArguments_->end(); ++it) | 54 it = getArguments_.begin(); it != getArguments_.end(); ++it) |
55 { | 55 { |
56 result[it->first] = it->second; | 56 result[it->first] = it->second; |
57 } | 57 } |
58 | 58 |
59 return true; | 59 return true; |
198 { | 198 { |
199 if (it->first->Match(components, trailing, uri)) | 199 if (it->first->Match(components, trailing, uri)) |
200 { | 200 { |
201 //LOG(INFO) << "REST GET call on: " << Toolbox::FlattenUri(uri); | 201 //LOG(INFO) << "REST GET call on: " << Toolbox::FlattenUri(uri); |
202 ok = true; | 202 ok = true; |
203 GetCall call; | 203 GetCall call(restOutput, *this, headers, components, trailing, uri, getArguments); |
204 call.output_ = &restOutput; | |
205 call.context_ = this; | |
206 call.httpHeaders_ = &headers; | |
207 call.uriComponents_ = &components; | |
208 call.trailing_ = &trailing; | |
209 call.fullUri_ = &uri; | |
210 | |
211 call.getArguments_ = &getArguments; | |
212 it->second(call); | 204 it->second(call); |
213 } | 205 } |
214 } | 206 } |
215 } | 207 } |
216 else if (method == HttpMethod_Put) | 208 else if (method == HttpMethod_Put) |
220 { | 212 { |
221 if (it->first->Match(components, trailing, uri)) | 213 if (it->first->Match(components, trailing, uri)) |
222 { | 214 { |
223 //LOG(INFO) << "REST PUT call on: " << Toolbox::FlattenUri(uri); | 215 //LOG(INFO) << "REST PUT call on: " << Toolbox::FlattenUri(uri); |
224 ok = true; | 216 ok = true; |
225 PutCall call; | 217 PutCall call(restOutput, *this, headers, components, trailing, uri, postData); |
226 call.output_ = &restOutput; | |
227 call.context_ = this; | |
228 call.httpHeaders_ = &headers; | |
229 call.uriComponents_ = &components; | |
230 call.trailing_ = &trailing; | |
231 call.fullUri_ = &uri; | |
232 | |
233 call.data_ = &postData; | |
234 it->second(call); | 218 it->second(call); |
235 } | 219 } |
236 } | 220 } |
237 } | 221 } |
238 else if (method == HttpMethod_Post) | 222 else if (method == HttpMethod_Post) |
242 { | 226 { |
243 if (it->first->Match(components, trailing, uri)) | 227 if (it->first->Match(components, trailing, uri)) |
244 { | 228 { |
245 //LOG(INFO) << "REST POST call on: " << Toolbox::FlattenUri(uri); | 229 //LOG(INFO) << "REST POST call on: " << Toolbox::FlattenUri(uri); |
246 ok = true; | 230 ok = true; |
247 PostCall call; | 231 PostCall call(restOutput, *this, headers, components, trailing, uri, postData); |
248 call.output_ = &restOutput; | |
249 call.context_ = this; | |
250 call.httpHeaders_ = &headers; | |
251 call.uriComponents_ = &components; | |
252 call.trailing_ = &trailing; | |
253 call.fullUri_ = &uri; | |
254 | |
255 call.data_ = &postData; | |
256 it->second(call); | 232 it->second(call); |
257 } | 233 } |
258 } | 234 } |
259 } | 235 } |
260 else if (method == HttpMethod_Delete) | 236 else if (method == HttpMethod_Delete) |
264 { | 240 { |
265 if (it->first->Match(components, trailing, uri)) | 241 if (it->first->Match(components, trailing, uri)) |
266 { | 242 { |
267 //LOG(INFO) << "REST DELETE call on: " << Toolbox::FlattenUri(uri); | 243 //LOG(INFO) << "REST DELETE call on: " << Toolbox::FlattenUri(uri); |
268 ok = true; | 244 ok = true; |
269 DeleteCall call; | 245 DeleteCall call(restOutput, *this, headers, components, trailing, uri); |
270 call.output_ = &restOutput; | |
271 call.context_ = this; | |
272 call.httpHeaders_ = &headers; | |
273 call.uriComponents_ = &components; | |
274 call.trailing_ = &trailing; | |
275 call.fullUri_ = &uri; | |
276 it->second(call); | 246 it->second(call); |
277 } | 247 } |
278 } | 248 } |
279 } | 249 } |
280 | 250 |