[Zrouter-src] ZRouter.org: push to zconf++ zconf++/http_json_handler.cc

zrouter-src at zrouter.org zrouter-src at zrouter.org
Wed Dec 7 23:05:35 UTC 2011


details:   /rev/ec53a4362b71
changeset: 25:ec53a4362b71
user:      "Nicolai Petri <nicolai at petri.dk>"
date:      Wed Dec 07 23:59:22 2011 +0100
description:
Rough parsing of req body as json and use as parameters for actions.

diffstat:

 zconf++/http_json_handler.cc |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r 61bcb9fad676 -r ec53a4362b71 zconf++/http_json_handler.cc
--- a/zconf++/http_json_handler.cc	Wed Dec 07 23:58:02 2011 +0100
+++ b/zconf++/http_json_handler.cc	Wed Dec 07 23:59:22 2011 +0100
@@ -27,6 +27,7 @@
 #include <boost/algorithm/string.hpp>
 #include <iostream>
 #include "model.h"
+#include "json_reader.h"
 #include "http_json_handler.h"
 #include "libzhttp/request.hpp"
 #include "libzhttp/reply.hpp"
@@ -78,7 +79,14 @@
 #else
 	std::stringstream ss;
 	if (leaf->type() == action_leaf) {
-		Leaf params("Dummy params");
+		Json::Reader r;
+		Leaf params;
+		std::cout << "GOT BODY : " << req.body << std::endl;
+		r.parse(req.body, params);
+		std::stringstream stest;
+		ModelWriter::write(stest, params, "PARSED REQ: ");
+		std::cout << stest.str() << std::endl;
+
 		Leaf resp = leaf->call(params);
 		ModelWriter::write(ss, resp, "");
 	} else {


More information about the Zrouter-src mailing list