summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server/InterpreterServlet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/server/InterpreterServlet.cpp')
-rw-r--r--src/uscxml/server/InterpreterServlet.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp
new file mode 100644
index 0000000..fb8a6ef
--- /dev/null
+++ b/src/uscxml/server/InterpreterServlet.cpp
@@ -0,0 +1,34 @@
+#include "InterpreterServlet.h"
+#include "uscxml/Interpreter.h"
+
+namespace uscxml {
+
+InterpreterServlet::InterpreterServlet(Interpreter* interpreter) {
+ _interpreter = interpreter;
+
+ std::stringstream path;
+ path << _interpreter->getName();
+ int i = 2;
+ while(!HTTPServer::registerServlet(path.str(), this)) {
+ path.clear();
+ path.str();
+ path << _interpreter->getName() << i++;
+ }
+ _path = path.str();
+}
+
+void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ // evhttp_request_own(req.curlReq);
+
+ _requests[toStr((uintptr_t)req.curlReq)] = req;
+
+ Event event = req;
+
+ event.name = "http." + event.data.compound["type"].atom;
+ event.origin = toStr((uintptr_t)req.curlReq);
+ _interpreter->receive(event);
+}
+
+} \ No newline at end of file