summaryrefslogtreecommitdiffstats
path: root/cpp/sca/modules/httpd
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-10-18 22:25:08 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-10-18 22:25:08 +0000
commitf87b9f1e48df02c26e0bbe3f8f1664c2b0862e52 (patch)
tree4d0ee23a5b5c7878b5b4f2131bc17f9765b93313 /cpp/sca/modules/httpd
parent6dd3610df5854ef9af7e5e2907b2f4065d69075d (diff)
Some fixes to the JSON and httpd support. Added support for Atom. Adjusted store test.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@826545 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/modules/httpd')
-rw-r--r--cpp/sca/modules/httpd/mod.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/cpp/sca/modules/httpd/mod.cpp b/cpp/sca/modules/httpd/mod.cpp
index feebca4b5c..81e12934e7 100644
--- a/cpp/sca/modules/httpd/mod.cpp
+++ b/cpp/sca/modules/httpd/mod.cpp
@@ -50,6 +50,7 @@
#include "list.hpp"
#include "slist.hpp"
#include "value.hpp"
+#include "element.hpp"
#include "monad.hpp"
#include "../json/json.hpp"
#include "../eval/driver.hpp"
@@ -160,7 +161,7 @@ const value evalLoop(std::istream& is, const value& req, Env& globalEnv) {
*/
const list<value> queryArg(std::string s) {
const list<std::string> t = tokenize("=", s);
- return makeList<value>(car(t).c_str(), cadr(t));
+ return mklist<value>(car(t).c_str(), cadr(t));
}
const list<list<value> > queryArgs(const request_rec* r) {
@@ -218,7 +219,7 @@ const int get(request_rec* r) {
// Convert the expr value to JSON
const JSONContext cx;
- failable<list<std::string>, std::string> jsval = writeJSON(cx, makeList<value>(makeList<value>("id", id), makeList<value>("result", val)));
+ failable<list<std::string>, std::string> jsval = writeJSON(cx, mklist<value>(mklist<value>("id", id), mklist<value>("result", val)));
if (!hasValue(jsval))
return HTTP_INTERNAL_SERVER_ERROR;
@@ -277,7 +278,7 @@ const int post(request_rec* r) {
// Read the JSON request
const list<std::string> req = read(r);
JSONContext cx;
- const list<value> json = readJSON(cx, req);
+ const list<value> json = elementsToValues(readJSON(cx, req));
const list<list<value> > args = postArgs(json);
// Extract the request id, method and params
@@ -298,7 +299,8 @@ const int post(request_rec* r) {
std::cout.flush();
// Convert the expr value to JSON
- failable<list<std::string>, std::string> jsval = writeJSON(cx, makeList<value>(makeList<value>("id", id), makeList<value>("result", val)));
+ const list<value> result = valuesToElements(mklist<value>(mklist<value>("id", id), mklist<value>("result", val)));
+ failable<list<std::string>, std::string> jsval = writeJSON(cx, result);
if (!hasValue(jsval))
return HTTP_INTERNAL_SERVER_ERROR;