diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-11-01 16:56:52 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-11-01 16:56:52 +0000 |
| commit | 2c74f2bf6cba53e17b5b36beacc895a121de3b4d (patch) | |
| tree | 8ac67bb64835019f5d93c2a27f7c2153165c849c /rotord/src/rotord.cpp | |
| parent | e67e0a69e8f168646076d26e7317eaec4e02058a (diff) | |
listnode/json
Diffstat (limited to 'rotord/src/rotord.cpp')
| -rw-r--r-- | rotord/src/rotord.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/rotord/src/rotord.cpp b/rotord/src/rotord.cpp index de853e4..c4c562e 100644 --- a/rotord/src/rotord.cpp +++ b/rotord/src/rotord.cpp @@ -212,8 +212,20 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS } } else if (command[0]=="listnode") { - XML.pushTag("rotor"); if (request.getMethod()=="GET") { + if (command.size()>1){ + if (command[1]=="json") { + Json::Value root; + Json::StyledWriter writer; + + Node_factory factory; + factory.list_node(body,root); + string content = writer.write(root); + status=HTTPResponse::HTTP_OK; + return new RenderContextHandler(content, status); + } + } + XML.pushTag("rotor"); Node_factory factory; if (factory.list_node(body,XML)) status=HTTPResponse::HTTP_OK; } |
