161 {L"direction", relpipe::writer::TypeId::STRING}, |
161 {L"direction", relpipe::writer::TypeId::STRING}, |
162 {L"name", relpipe::writer::TypeId::STRING}, |
162 {L"name", relpipe::writer::TypeId::STRING}, |
163 {L"value", relpipe::writer::TypeId::STRING}, |
163 {L"value", relpipe::writer::TypeId::STRING}, |
164 }, true); |
164 }, true); |
165 |
165 |
166 for (const HTTPServer::Header& h : request.header) { |
166 for (const HTTPServer::AVP& h : request.header) { |
167 relationalWriter->writeAttribute(exchangeId); |
167 relationalWriter->writeAttribute(exchangeId); |
168 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
168 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
169 relationalWriter->writeAttribute(L"request"); |
169 relationalWriter->writeAttribute(L"request"); |
170 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
170 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
171 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
171 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
172 } |
172 } |
173 |
173 |
174 for (const HTTPServer::Header& h : response.header) { |
174 for (const HTTPServer::AVP& h : response.header) { |
175 relationalWriter->writeAttribute(exchangeId); |
175 relationalWriter->writeAttribute(exchangeId); |
176 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
176 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
177 relationalWriter->writeAttribute(L"response"); |
177 relationalWriter->writeAttribute(L"response"); |
|
178 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
|
179 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
|
180 } |
|
181 |
|
182 relationalWriter->startRelation(L"cookie",{ |
|
183 // TODO: ordinal number? |
|
184 {L"exchange", relpipe::writer::TypeId::STRING}, |
|
185 {L"url", relpipe::writer::TypeId::STRING}, |
|
186 {L"direction", relpipe::writer::TypeId::STRING}, |
|
187 {L"name", relpipe::writer::TypeId::STRING}, |
|
188 {L"value", relpipe::writer::TypeId::STRING}, |
|
189 }, true); |
|
190 |
|
191 for (const HTTPServer::AVP& h : request.cookie) { |
|
192 relationalWriter->writeAttribute(exchangeId); |
|
193 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
|
194 relationalWriter->writeAttribute(L"request"); |
|
195 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
|
196 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
|
197 } |
|
198 |
|
199 for (const HTTPServer::AVP& h : response.cookie) { |
|
200 relationalWriter->writeAttribute(exchangeId); |
|
201 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
|
202 relationalWriter->writeAttribute(L"response"); |
|
203 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
|
204 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
|
205 } |
|
206 |
|
207 relationalWriter->startRelation(L"get_parameter",{ |
|
208 // TODO: ordinal number? |
|
209 {L"exchange", relpipe::writer::TypeId::STRING}, |
|
210 {L"url", relpipe::writer::TypeId::STRING}, |
|
211 {L"name", relpipe::writer::TypeId::STRING}, |
|
212 {L"value", relpipe::writer::TypeId::STRING}, |
|
213 }, true); |
|
214 |
|
215 for (const HTTPServer::AVP& h : request.getParameter) { |
|
216 relationalWriter->writeAttribute(exchangeId); |
|
217 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
|
218 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
|
219 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
|
220 } |
|
221 |
|
222 relationalWriter->startRelation(L"post_parameter",{ |
|
223 // TODO: ordinal number? |
|
224 {L"exchange", relpipe::writer::TypeId::STRING}, |
|
225 {L"url", relpipe::writer::TypeId::STRING}, |
|
226 {L"name", relpipe::writer::TypeId::STRING}, |
|
227 {L"value", relpipe::writer::TypeId::STRING}, |
|
228 }, true); |
|
229 |
|
230 for (const HTTPServer::AVP& h : request.postParameter) { |
|
231 relationalWriter->writeAttribute(exchangeId); |
|
232 relationalWriter->writeAttribute(convertor.from_bytes(request.url)); |
178 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
233 relationalWriter->writeAttribute(convertor.from_bytes(h.name)); |
179 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
234 relationalWriter->writeAttribute(convertor.from_bytes(h.value)); |
180 } |
235 } |
181 |
236 |
182 |
237 |
210 for (ResponseTemplate t : *responseTemplates) { |
265 for (ResponseTemplate t : *responseTemplates) { |
211 if (t.matches(request.method, request.url)) { |
266 if (t.matches(request.method, request.url)) { |
212 response.code = t.code; |
267 response.code = t.code; |
213 response.body = t.body; |
268 response.body = t.body; |
214 // TODO: replace global header values with request-specific ones instead of appending? |
269 // TODO: replace global header values with request-specific ones instead of appending? |
215 for (const GlobalHeaderTemplate& h : *headerTemplates) if (h.matches(request.method, request.url)) response.header.push_back(HTTPServer::Header(h.name, h.value)); |
270 for (const GlobalHeaderTemplate& h : *headerTemplates) if (h.matches(request.method, request.url)) response.header.push_back({h.name, h.value}); |
216 for (const HeaderTemplate& h : t.headers) response.header.push_back(HTTPServer::Header(h.name, h.value)); |
271 for (const HeaderTemplate& h : t.headers) response.header.push_back({h.name, h.value}); |
217 break; |
272 break; |
218 } |
273 } |
219 } |
274 } |
220 |
275 |
221 writeExchange(request, response); |
276 writeExchange(request, response); |