diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-13 13:29:38 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-13 13:29:38 (GMT) |
commit | fe941ab36b44f083886c07a72d371b2cfba55fe3 (patch) | |
tree | 2dfe945f5b0b4272f573cda18f24caa623c122c7 /test/src/test-vxml-mmi-http.cpp | |
parent | 02f52d15e7df2500c0c6e96660a43a985add16e8 (diff) | |
download | uscxml-fe941ab36b44f083886c07a72d371b2cfba55fe3.zip uscxml-fe941ab36b44f083886c07a72d371b2cfba55fe3.tar.gz uscxml-fe941ab36b44f083886c07a72d371b2cfba55fe3.tar.bz2 |
Build on Linux and Windows again
Diffstat (limited to 'test/src/test-vxml-mmi-http.cpp')
-rw-r--r-- | test/src/test-vxml-mmi-http.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/test/src/test-vxml-mmi-http.cpp b/test/src/test-vxml-mmi-http.cpp index 50a8dd0..130441c 100644 --- a/test/src/test-vxml-mmi-http.cpp +++ b/test/src/test-vxml-mmi-http.cpp @@ -31,9 +31,10 @@ std::stringstream name##XMLSS;\ name##XMLSS << name##XML;\ URL name##URL(target);\ + std::cout << name##XMLSS.str();\ name##URL.setOutContent(name##XMLSS.str());\ name##URL.addOutHeader("Content-type", "application/xml");\ - name##URL.download(true);\ + name##URL.download(false);\ } using namespace uscxml; @@ -44,25 +45,34 @@ std::map<std::string, MMIEvent*> Replies; tthread::condition_variable Cond; tthread::mutex Mutex; +std::string context; + class MMIServlet : public HTTPServlet { public: bool httpRecvRequest(const HTTPServer::Request& request) { tthread::lock_guard<tthread::mutex> lock(Mutex); - NameSpacingParser parser = NameSpacingParser::fromXML(request.content); - switch(MMIEvent::getType(parser.getDocument().getDocumentElement())) { + const Arabica::DOM::Document<std::string>& doc = request.data.at("content").node.getOwnerDocument(); +// NameSpacingParser parser = NameSpacingParser::fromXML(request.content); + switch(MMIEvent::getType(doc.getDocumentElement())) { case MMIEvent::NEWCONTEXTRESPONSE: { - NewContextResponse* resp = new NewContextResponse(NewContextResponse::fromXML(parser.getDocument().getDocumentElement())); + NewContextResponse* resp = new NewContextResponse(NewContextResponse::fromXML(doc.getDocumentElement())); + context = resp->context; Replies[resp->requestId] = resp; + break; } case MMIEvent::STARTRESPONSE: { - StartResponse* resp = new StartResponse(StartResponse::fromXML(parser.getDocument().getDocumentElement())); + StartResponse* resp = new StartResponse(StartResponse::fromXML(doc.getDocumentElement())); Replies[resp->requestId] = resp; } default: ; } Cond.notify_all(); + + HTTPServer::Reply reply(request); + HTTPServer::reply(reply); + return true; } void setURL(const std::string& url) { @@ -135,7 +145,7 @@ int main(int argc, char** argv) { NewContextRequest newCtxReq; newCtxReq.source = source; newCtxReq.target = target; - newCtxReq.requestId = UUID::getUUID(); + newCtxReq.requestId = uscxml::UUID::getUUID(); Requests[newCtxReq.requestId] = &newCtxReq; ISSUE_REQUEST(newCtxReq); @@ -144,9 +154,10 @@ int main(int argc, char** argv) { Cond.wait(Mutex); StartRequest startReq; + startReq.context = context; startReq.source = source; startReq.target = target; - startReq.requestId = UUID::getUUID(); + startReq.requestId = uscxml::UUID::getUUID(); startReq.contentURL.href = document; //"https://raw.githubusercontent.com/Roland-Taizun-Azhar/TaskAssistance-Project/master/WebContent/hello.vxml"; |