comparison Core/RestApi/RestApi.cpp @ 901:7d88f3f4a3b3 plugins

refactoring IsServedUri, answer PNG images, regular expression groups
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Jun 2014 15:22:13 +0200
parents 7e8cde5905fd
children 6968356679c0
comparison
equal deleted inserted replaced
900:1b92ce45cc8d 901:7d88f3f4a3b3
170 { 170 {
171 delete it->first; 171 delete it->first;
172 } 172 }
173 } 173 }
174 174
175 bool RestApi::IsServedUri(const UriComponents& uri)
176 {
177 return (IsGetAccepted(uri) ||
178 IsPutAccepted(uri) ||
179 IsPostAccepted(uri) ||
180 IsDeleteAccepted(uri));
181 }
182 175
183 bool RestApi::Handle(HttpOutput& output, 176 bool RestApi::Handle(HttpOutput& output,
184 HttpMethod method, 177 HttpMethod method,
185 const UriComponents& uri, 178 const UriComponents& uri,
186 const Arguments& headers, 179 const Arguments& headers,
187 const Arguments& getArguments, 180 const Arguments& getArguments,
188 const std::string& postData) 181 const std::string& postData)
189 { 182 {
183 if (!IsGetAccepted(uri) &&
184 !IsPutAccepted(uri) &&
185 !IsPostAccepted(uri) &&
186 !IsDeleteAccepted(uri))
187 {
188 // This URI is not served by this handler
189 return false;
190 }
191
192
190 bool ok = false; 193 bool ok = false;
191 RestApiOutput restOutput(output); 194 RestApiOutput restOutput(output);
192 RestApiPath::Components components; 195 RestApiPath::Components components;
193 UriComponents trailing; 196 UriComponents trailing;
194 197