diff options
| author | Comment <tim@gray.(none)> | 2013-09-24 14:49:29 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-09-24 14:49:29 +0100 |
| commit | f40d511775eb8dfae9a28870c5e0125b5e55b305 (patch) | |
| tree | 1f26641cbfd4a9515f999cd03b5a73675ee75656 /rotord/src/rotord.cpp | |
| parent | 6e615b00dbb54f33b928e0de0695087709fbc073 (diff) | |
category list XML/json
Diffstat (limited to 'rotord/src/rotord.cpp')
| -rw-r--r-- | rotord/src/rotord.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/rotord/src/rotord.cpp b/rotord/src/rotord.cpp index e7c68cf..a22c6c3 100644 --- a/rotord/src/rotord.cpp +++ b/rotord/src/rotord.cpp @@ -187,6 +187,30 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS } } } + else if (command[0]=="listcategories") { + if (command.size()>1){ + if (command[1]=="json") { + Json::Value root; + Json::StyledWriter writer; + //root["title"]="Lights Down @Rotor"; + //root["audio"]="filename"; + + Node_factory factory; + factory.list_categories(root); + string content = writer.write(root); + status=HTTPResponse::HTTP_OK; + return new RenderContextHandler(content, status); + } + } + else { + XML.pushTag("rotor"); + if (request.getMethod()=="GET") { + Node_factory factory; + factory.list_categories(XML); + status=HTTPResponse::HTTP_OK; + } + } + } else if (command[0]=="listnode") { XML.pushTag("rotor"); if (request.getMethod()=="GET") { |
