annotate Core/RestApi/RestApiHierarchy.cpp @ 1018:564e39d6df13 lua-scripting

integration mainline->lua-scripting
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Jul 2014 11:31:14 +0200
parents f1ff2a2f06cd
children 0332e6e8c679
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege,
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
3dce528b0cc2 RestApiHierarchy
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
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include "RestApiHierarchy.h"
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
975
c550e99c452b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
35 #include "../OrthancException.h"
c550e99c452b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
36
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include <cassert>
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Orthanc
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
41 RestApiHierarchy::Resource::Resource() :
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
42 getHandler_(NULL),
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
43 postHandler_(NULL),
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
44 putHandler_(NULL),
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
45 deleteHandler_(NULL)
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
46 {
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
47 }
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
48
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
49
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
50 bool RestApiHierarchy::Resource::HasHandler(HttpMethod method) const
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
51 {
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
52 switch (method)
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
53 {
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
54 case HttpMethod_Get:
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
55 return getHandler_ != NULL;
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
56
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
57 case HttpMethod_Post:
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
58 return postHandler_ != NULL;
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
59
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
60 case HttpMethod_Put:
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
61 return putHandler_ != NULL;
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
62
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
63 case HttpMethod_Delete:
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
64 return deleteHandler_ != NULL;
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
65
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
66 default:
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
67 throw OrthancException(ErrorCode_ParameterOutOfRange);
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
68 }
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
69 }
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
70
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
71
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
72 bool RestApiHierarchy::Resource::IsEmpty() const
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 {
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
74 return (getHandler_ == NULL &&
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
75 postHandler_ == NULL &&
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
76 putHandler_ == NULL &&
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
77 deleteHandler_ == NULL);
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
78 }
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
79
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
80
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 RestApiHierarchy& RestApiHierarchy::AddChild(Children& children,
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 const std::string& name)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 Children::iterator it = children.find(name);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 if (it == children.end())
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 // Create new child
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 RestApiHierarchy *child = new RestApiHierarchy;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 children[name] = child;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 return *child;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 else
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 return *it->second;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
100
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
101 bool RestApiHierarchy::Resource::Handle(RestApiGetCall& call) const
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
102 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
103 if (getHandler_ != NULL)
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
104 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
105 getHandler_(call);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
106 return true;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
107 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
108 else
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
109 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
110 return false;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
111 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
112 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
113
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
114
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
115 bool RestApiHierarchy::Resource::Handle(RestApiPutCall& call) const
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
116 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
117 if (putHandler_ != NULL)
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
118 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
119 putHandler_(call);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
120 return true;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
121 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
122 else
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
123 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
124 return false;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
125 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
126 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
127
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
128
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
129 bool RestApiHierarchy::Resource::Handle(RestApiPostCall& call) const
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
130 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
131 if (postHandler_ != NULL)
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
132 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
133 postHandler_(call);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
134 return true;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
135 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
136 else
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
137 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
138 return false;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
139 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
140 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
141
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
142
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
143 bool RestApiHierarchy::Resource::Handle(RestApiDeleteCall& call) const
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
144 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
145 if (deleteHandler_ != NULL)
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
146 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
147 deleteHandler_(call);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
148 return true;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
149 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
150 else
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
151 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
152 return false;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
153 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
154 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
155
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
156
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
157
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 void RestApiHierarchy::DeleteChildren(Children& children)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 for (Children::iterator it = children.begin();
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 it != children.end(); it++)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 delete it->second;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 template <typename Handler>
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 void RestApiHierarchy::RegisterInternal(const RestApiPath& path,
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 Handler handler,
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 size_t level)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 if (path.GetLevelCount() == level)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 if (path.IsUniversalTrailing())
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 universalHandlers_.Register(handler);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 else
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 handlers_.Register(handler);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 else
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 RestApiHierarchy* child;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 if (path.IsWildcardLevel(level))
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 child = &AddChild(wildcardChildren_, path.GetWildcardName(level));
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 else
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 child = &AddChild(children_, path.GetLevelName(level));
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 child->RegisterInternal(path, handler, level + 1);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
201 bool RestApiHierarchy::LookupResource(HttpHandler::Arguments& components,
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 const UriComponents& uri,
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
203 IVisitor& visitor,
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
204 size_t level)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
206 if (uri.size() != 0 &&
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
207 level > uri.size())
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
208 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
209 return false;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
210 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
211
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 UriComponents trailing;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 // Look for an exact match on the resource of interest
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
215 if (uri.size() == 0 ||
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
216 level == uri.size())
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 if (!handlers_.IsEmpty() &&
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
219 visitor.Visit(handlers_, uri, components, trailing))
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 return true;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
226 if (level < uri.size()) // A recursive call is possible
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
228 // Try and go down in the hierarchy, using an exact match for the child
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
229 Children::const_iterator child = children_.find(uri[level]);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
230 if (child != children_.end())
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
232 if (child->second->LookupResource(components, uri, visitor, level + 1))
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
233 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
234 return true;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
235 }
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
238 // Try and go down in the hierarchy, using wildcard rules for children
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
239 for (child = wildcardChildren_.begin();
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
240 child != wildcardChildren_.end(); child++)
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
241 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
242 HttpHandler::Arguments subComponents = components;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
243 subComponents[child->first] = uri[level];
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
245 if (child->second->LookupResource(subComponents, uri, visitor, level + 1))
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
246 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
247 return true;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
248 }
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
249 }
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 // As a last resort, call the universal handlers, if any
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 if (!universalHandlers_.IsEmpty())
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 trailing.resize(uri.size() - level);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 size_t pos = 0;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 for (size_t i = level; i < uri.size(); i++, pos++)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 trailing[pos] = uri[i];
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 assert(pos == trailing.size());
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
265 if (visitor.Visit(universalHandlers_, uri, components, trailing))
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 return true;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 return false;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
275 bool RestApiHierarchy::CanGenerateDirectory() const
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
276 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
277 return (!handlers_.HasHandler(HttpMethod_Get) &&
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
278 universalHandlers_.IsEmpty() &&
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
279 wildcardChildren_.size() == 0);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
280 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
281
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
282
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 bool RestApiHierarchy::GetDirectory(Json::Value& result,
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 const UriComponents& uri,
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 size_t level)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 if (uri.size() == level)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 {
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
289 if (CanGenerateDirectory())
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 result = Json::arrayValue;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 for (Children::const_iterator it = children_.begin();
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 it != children_.end(); it++)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 result.append(it->first);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 return true;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 else
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 return false;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 Children::const_iterator child = children_.find(uri[level]);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 if (child != children_.end())
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310 if (child->second->GetDirectory(result, uri, level + 1))
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 return true;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 for (child = wildcardChildren_.begin();
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 child != wildcardChildren_.end(); child++)
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 if (child->second->GetDirectory(result, uri, level + 1))
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 return true;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 return false;
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 RestApiHierarchy::~RestApiHierarchy()
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 {
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 DeleteChildren(children_);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 DeleteChildren(wildcardChildren_);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
335 void RestApiHierarchy::Register(const std::string& uri,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 972
diff changeset
336 RestApiGetCall::Handler handler)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 {
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
338 RestApiPath path(uri);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 RegisterInternal(path, handler, 0);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
342 void RestApiHierarchy::Register(const std::string& uri,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 972
diff changeset
343 RestApiPutCall::Handler handler)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 {
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
345 RestApiPath path(uri);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 RegisterInternal(path, handler, 0);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
349 void RestApiHierarchy::Register(const std::string& uri,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 972
diff changeset
350 RestApiPostCall::Handler handler)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 {
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
352 RestApiPath path(uri);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 RegisterInternal(path, handler, 0);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
356 void RestApiHierarchy::Register(const std::string& uri,
974
83622b0f544c refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 972
diff changeset
357 RestApiDeleteCall::Handler handler)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 {
970
1a3817d84f39 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 969
diff changeset
359 RestApiPath path(uri);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 RegisterInternal(path, handler, 0);
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 void RestApiHierarchy::CreateSiteMap(Json::Value& target) const
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
365 target = Json::objectValue;
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
366
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
367 /*std::string s = " ";
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
368 if (handlers_.HasHandler(HttpMethod_Get))
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
370 s += "GET ";
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
373 if (handlers_.HasHandler(HttpMethod_Post))
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
375 s += "POST ";
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
378 if (handlers_.HasHandler(HttpMethod_Put))
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
380 s += "PUT ";
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382
972
2047e6f033bd refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 970
diff changeset
383 if (handlers_.HasHandler(HttpMethod_Delete))
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
385 s += "DELETE ";
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
388 target = s;*/
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
389
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
390 for (Children::const_iterator it = children_.begin();
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
391 it != children_.end(); it++)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 {
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
393 it->second->CreateSiteMap(target[it->first]);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395
980
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
396 for (Children::const_iterator it = wildcardChildren_.begin();
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
397 it != wildcardChildren_.end(); it++)
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
398 {
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
399 it->second->CreateSiteMap(target["<" + it->first + ">"]);
f1ff2a2f06cd use RestApiHierarchy inside RestApi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 978
diff changeset
400 }
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
403
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
404 bool RestApiHierarchy::LookupResource(const UriComponents& uri,
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
405 IVisitor& visitor)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 {
975
c550e99c452b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
407 HttpHandler::Arguments components;
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
408 return LookupResource(components, uri, visitor, 0);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 }
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
411
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
412
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
413 namespace
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
414 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
415 // Anonymous namespace to avoid clashes between compilation modules
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
416
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
417 class AcceptedMethodsVisitor : public RestApiHierarchy::IVisitor
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
418 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
419 private:
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
420 std::set<HttpMethod>& methods_;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
421
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
422 public:
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
423 AcceptedMethodsVisitor(std::set<HttpMethod>& methods) : methods_(methods)
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
424 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
425 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
426
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
427 virtual bool Visit(const RestApiHierarchy::Resource& resource,
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
428 const UriComponents& uri,
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
429 const HttpHandler::Arguments& components,
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
430 const UriComponents& trailing)
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
431 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
432 if (trailing.size() == 0) // Ignore universal handlers
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
433 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
434 if (resource.HasHandler(HttpMethod_Get))
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
435 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
436 methods_.insert(HttpMethod_Get);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
437 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
438
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
439 if (resource.HasHandler(HttpMethod_Post))
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
440 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
441 methods_.insert(HttpMethod_Post);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
442 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
443
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
444 if (resource.HasHandler(HttpMethod_Put))
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
445 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
446 methods_.insert(HttpMethod_Put);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
447 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
448
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
449 if (resource.HasHandler(HttpMethod_Delete))
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
450 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
451 methods_.insert(HttpMethod_Delete);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
452 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
453 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
454
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
455 return false; // Continue to check all the possible ways to access this URI
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
456 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
457 };
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
458 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
459
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
460 void RestApiHierarchy::GetAcceptedMethods(std::set<HttpMethod>& methods,
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
461 const UriComponents& uri)
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 {
975
c550e99c452b refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 974
diff changeset
463 HttpHandler::Arguments components;
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
464 AcceptedMethodsVisitor visitor(methods);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
465 LookupResource(components, uri, visitor, 0);
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466
978
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
467 Json::Value d;
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
468 if (GetDirectory(d, uri))
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
469 {
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
470 methods.insert(HttpMethod_Get);
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
471 }
ce3106e5843f refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 975
diff changeset
472 }
969
3dce528b0cc2 RestApiHierarchy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 }