annotate Core/RestApi/RestApi.cpp @ 1511:7962563129c9

starting support of deflate/gzip content types
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Aug 2015 14:18:24 +0200
parents f967bdf8534e
children d73a2178b319
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1113
diff changeset
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1113
diff changeset
4 * Department, University Hospital of Liege, Belgium
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
824
a811bdf8b8eb precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
33 #include "../PrecompiledHeaders.h"
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "RestApi.h"
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
1486
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1446
diff changeset
36 #include "../Logging.h"
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1446
diff changeset
37
249
5694365ecb96 fixes for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 215
diff changeset
38 #include <stdlib.h> // To define "_exit()" under Windows
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
39 #include <stdio.h>
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
40
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace Orthanc
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
43 namespace
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
45 // Anonymous namespace to avoid clashes between compilation modules
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
46 class HttpHandlerVisitor : public RestApiHierarchy::IVisitor
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
48 private:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
49 RestApi& api_;
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
50 RestApiOutput& output_;
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
51 HttpMethod method_;
1441
f3672356c121 refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
52 const IHttpHandler::Arguments& headers_;
f3672356c121 refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
53 const IHttpHandler::Arguments& getArguments_;
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
54 const char* bodyData_;
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
55 size_t bodySize_;
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
56
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
57 public:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
58 HttpHandlerVisitor(RestApi& api,
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
59 RestApiOutput& output,
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
60 HttpMethod method,
1441
f3672356c121 refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
61 const IHttpHandler::Arguments& headers,
f3672356c121 refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
62 const IHttpHandler::Arguments& getArguments,
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
63 const char* bodyData,
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
64 size_t bodySize) :
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
65 api_(api),
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
66 output_(output),
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
67 method_(method),
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
68 headers_(headers),
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
69 getArguments_(getArguments),
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
70 bodyData_(bodyData),
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
71 bodySize_(bodySize)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 {
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
74
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
75 virtual bool Visit(const RestApiHierarchy::Resource& resource,
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
76 const UriComponents& uri,
1441
f3672356c121 refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
77 const IHttpHandler::Arguments& components,
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
78 const UriComponents& trailing)
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
79 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
80 if (resource.HasHandler(method_))
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
81 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
82 switch (method_)
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
83 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
84 case HttpMethod_Get:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
85 {
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
86 RestApiGetCall call(output_, api_, headers_, components, trailing, uri, getArguments_);
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
87 resource.Handle(call);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
88 return true;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
89 }
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
91 case HttpMethod_Post:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
92 {
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
93 RestApiPostCall call(output_, api_, headers_, components, trailing, uri, bodyData_, bodySize_);
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
94 resource.Handle(call);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
95 return true;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
96 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
97
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
98 case HttpMethod_Delete:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
99 {
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
100 RestApiDeleteCall call(output_, api_, headers_, components, trailing, uri);
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
101 resource.Handle(call);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
102 return true;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
103 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
104
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
105 case HttpMethod_Put:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
106 {
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
107 RestApiPutCall call(output_, api_, headers_, components, trailing, uri, bodyData_, bodySize_);
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
108 resource.Handle(call);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
109 return true;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
110 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
111
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
112 default:
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
113 return false;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
114 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
115 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
116
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
117 return false;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
118 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
119 };
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 static void AddMethod(std::string& target,
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 const std::string& method)
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 {
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 if (target.size() > 0)
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 target += "," + method;
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 else
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 target = method;
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
133 static std::string MethodsToString(const std::set<HttpMethod>& methods)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 {
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 std::string s;
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
137 if (methods.find(HttpMethod_Get) != methods.end())
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
138 {
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 AddMethod(s, "GET");
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
140 }
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
142 if (methods.find(HttpMethod_Post) != methods.end())
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
143 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
144 AddMethod(s, "POST");
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
145 }
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
147 if (methods.find(HttpMethod_Put) != methods.end())
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
148 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
149 AddMethod(s, "PUT");
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
150 }
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
152 if (methods.find(HttpMethod_Delete) != methods.end())
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
153 {
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 AddMethod(s, "DELETE");
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
155 }
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 return s;
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
895
7e8cde5905fd allow superposition of REST handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
162 bool RestApi::Handle(HttpOutput& output,
473
c9a5d72f8481 changing the namespace of HTTP enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 416
diff changeset
163 HttpMethod method,
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 const UriComponents& uri,
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 const Arguments& headers,
1363
feaf2840917c Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
166 const GetArguments& getArguments,
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
167 const char* bodyData,
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
168 size_t bodySize)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
1368
b22ba8c5edbe query retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1363
diff changeset
170 RestApiOutput wrappedOutput(output, method);
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
171
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
172 #if ORTHANC_PUGIXML_ENABLED == 1
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
173 {
1511
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
174 // Look if the client wishes XML answers instead of JSON
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
175 // http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z3
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
176 Arguments::const_iterator it = headers.find("accept");
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
177 if (it != headers.end())
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
178 {
1511
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
179 std::vector<std::string> accepted;
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
180 Toolbox::TokenizeString(accepted, it->second, ';');
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
181 for (size_t i = 0; i < accepted.size(); i++)
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
182 {
1511
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
183 if (accepted[i] == "application/xml")
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
184 {
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
185 wrappedOutput.SetConvertJsonToXml(true);
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
186 }
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
187
1511
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
188 if (accepted[i] == "application/json")
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
189 {
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
190 wrappedOutput.SetConvertJsonToXml(false);
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
191 }
1046
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
192 }
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
193 }
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
194 }
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
195 #endif
00f9f36bcd94 on-the-fly conversion of JSON to XML according to HTTP Accept
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1042
diff changeset
196
1511
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
197 {
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
198 // Look if the client wishes HTTP compression
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
199 // https://en.wikipedia.org/wiki/HTTP_compression
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
200 Arguments::const_iterator it = headers.find("accept-encoding");
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
201 if (it != headers.end())
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
202 {
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
203 std::vector<std::string> encodings;
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
204 Toolbox::TokenizeString(encodings, it->second, ',');
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
205 for (size_t i = 0; i < encodings.size(); i++)
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
206 {
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
207 std::string s = Toolbox::StripSpaces(encodings[i]);
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
208 if (s == "deflate")
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
209 {
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
210 wrappedOutput.SetHttpCompression(HttpCompression_Deflate);
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
211 }
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
212
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
213 // TODO HttpCompression_Gzip ?
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
214 }
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
215 }
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
216 }
7962563129c9 starting support of deflate/gzip content types
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
217
1363
feaf2840917c Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
218 Arguments compiled;
1441
f3672356c121 refactoring: IHttpHandler and HttpToolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1368
diff changeset
219 HttpToolbox::CompileGetArguments(compiled, getArguments);
1363
feaf2840917c Plugins now receive duplicated GET arguments in their REST callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
220
1446
8dc80ba768aa refactoring: IHttpHandler does not use std::string to hold the request body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1441
diff changeset
221 HttpHandlerVisitor visitor(*this, wrappedOutput, method, headers, compiled, bodyData, bodySize);
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
222
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
223 if (root_.LookupResource(uri, visitor))
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 895
diff changeset
224 {
1113
ba5c0908600c Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1063
diff changeset
225 wrappedOutput.Finalize();
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
226 return true;
901
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 895
diff changeset
227 }
7d88f3f4a3b3 refactoring IsServedUri, answer PNG images, regular expression groups
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 895
diff changeset
228
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
229 std::set<HttpMethod> methods;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
230 root_.GetAcceptedMethods(methods, uri);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
231
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
232 if (methods.empty())
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
233 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
234 return false; // This URI is not served by this REST API
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
235 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
236 else
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 {
477
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 473
diff changeset
238 LOG(INFO) << "REST method " << EnumerationToString(method)
416
1188cb0ddaa5 http method faking
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 398
diff changeset
239 << " not allowed on: " << Toolbox::FlattenUri(uri);
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
240
1042
8d1845feb277 set cookies, not allowed methods, unauthorized in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 980
diff changeset
241 output.SendMethodNotAllowed(MethodsToString(methods));
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
242
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 977
diff changeset
243 return true;
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 void RestApi::Register(const std::string& path,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
248 RestApiGetCall::Handler handler)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 {
977
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 976
diff changeset
250 root_.Register(path, handler);
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 void RestApi::Register(const std::string& path,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
254 RestApiPutCall::Handler handler)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 {
977
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 976
diff changeset
256 root_.Register(path, handler);
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 void RestApi::Register(const std::string& path,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
260 RestApiPostCall::Handler handler)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 {
977
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 976
diff changeset
262 root_.Register(path, handler);
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 }
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 void RestApi::Register(const std::string& path,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
266 RestApiDeleteCall::Handler handler)
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 {
977
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 976
diff changeset
268 root_.Register(path, handler);
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 }
1063
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
270
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
271 void RestApi::AutoListChildren(RestApiGetCall& call)
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
272 {
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
273 RestApi& context = call.GetContext();
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
274
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
275 Json::Value directory;
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
276 if (context.root_.GetDirectory(directory, call.GetFullUri()))
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
277 {
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
278 call.GetOutput().AnswerJson(directory);
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
279 }
0332e6e8c679 Fix automated generation of the list of resource children in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1046
diff changeset
280 }
209
9960642f0f45 abstraction of RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 }