Mercurial > hg > orthanc
comparison Core/RestApi/RestApi.cpp @ 1441:f3672356c121
refactoring: IHttpHandler and HttpToolbox
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Jul 2015 10:38:39 +0200 |
parents | b22ba8c5edbe |
children | 8dc80ba768aa |
comparison
equal
deleted
inserted
replaced
1440:3567503c00a7 | 1441:f3672356c121 |
---|---|
47 { | 47 { |
48 private: | 48 private: |
49 RestApi& api_; | 49 RestApi& api_; |
50 RestApiOutput& output_; | 50 RestApiOutput& output_; |
51 HttpMethod method_; | 51 HttpMethod method_; |
52 const HttpHandler::Arguments& headers_; | 52 const IHttpHandler::Arguments& headers_; |
53 const HttpHandler::Arguments& getArguments_; | 53 const IHttpHandler::Arguments& getArguments_; |
54 const std::string& postData_; | 54 const std::string& postData_; |
55 | 55 |
56 public: | 56 public: |
57 HttpHandlerVisitor(RestApi& api, | 57 HttpHandlerVisitor(RestApi& api, |
58 RestApiOutput& output, | 58 RestApiOutput& output, |
59 HttpMethod method, | 59 HttpMethod method, |
60 const HttpHandler::Arguments& headers, | 60 const IHttpHandler::Arguments& headers, |
61 const HttpHandler::Arguments& getArguments, | 61 const IHttpHandler::Arguments& getArguments, |
62 const std::string& postData) : | 62 const std::string& postData) : |
63 api_(api), | 63 api_(api), |
64 output_(output), | 64 output_(output), |
65 method_(method), | 65 method_(method), |
66 headers_(headers), | 66 headers_(headers), |
69 { | 69 { |
70 } | 70 } |
71 | 71 |
72 virtual bool Visit(const RestApiHierarchy::Resource& resource, | 72 virtual bool Visit(const RestApiHierarchy::Resource& resource, |
73 const UriComponents& uri, | 73 const UriComponents& uri, |
74 const HttpHandler::Arguments& components, | 74 const IHttpHandler::Arguments& components, |
75 const UriComponents& trailing) | 75 const UriComponents& trailing) |
76 { | 76 { |
77 if (resource.HasHandler(method_)) | 77 if (resource.HasHandler(method_)) |
78 { | 78 { |
79 switch (method_) | 79 switch (method_) |
187 } | 187 } |
188 } | 188 } |
189 #endif | 189 #endif |
190 | 190 |
191 Arguments compiled; | 191 Arguments compiled; |
192 HttpHandler::CompileGetArguments(compiled, getArguments); | 192 HttpToolbox::CompileGetArguments(compiled, getArguments); |
193 | 193 |
194 HttpHandlerVisitor visitor(*this, wrappedOutput, method, headers, compiled, postData); | 194 HttpHandlerVisitor visitor(*this, wrappedOutput, method, headers, compiled, postData); |
195 | 195 |
196 if (root_.LookupResource(uri, visitor)) | 196 if (root_.LookupResource(uri, visitor)) |
197 { | 197 { |