diff options
Diffstat (limited to 'src/uscxml/server')
-rw-r--r-- | src/uscxml/server/InterpreterServlet.cpp | 18 | ||||
-rw-r--r-- | src/uscxml/server/InterpreterServlet.h | 18 |
2 files changed, 35 insertions, 1 deletions
diff --git a/src/uscxml/server/InterpreterServlet.cpp b/src/uscxml/server/InterpreterServlet.cpp index e537275..99b81b2 100644 --- a/src/uscxml/server/InterpreterServlet.cpp +++ b/src/uscxml/server/InterpreterServlet.cpp @@ -1,5 +1,6 @@ #include "InterpreterServlet.h" #include "uscxml/Interpreter.h" +#include <glog/logging.h> namespace uscxml { @@ -17,6 +18,12 @@ InterpreterServlet::InterpreterServlet(Interpreter* interpreter) { _path = path.str(); } +boost::shared_ptr<IOProcessorImpl> InterpreterServlet::create(Interpreter* interpreter) { + // we instantiate directly in Interpreter + boost::shared_ptr<IOProcessorImpl> io = boost::shared_ptr<InterpreterServlet>(new InterpreterServlet(interpreter)); + return io; +} + void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); @@ -31,4 +38,15 @@ void InterpreterServlet::httpRecvRequest(const HTTPServer::Request& req) { _interpreter->receive(event); } +Data InterpreterServlet::getDataModelVariables() { + Data data; + assert(_url.length() > 0); + data.compound["location"] = Data(_url, Data::VERBATIM); + return data; +} + +void InterpreterServlet::send(const SendRequest& req) { + LOG(ERROR) << "send not supported by http iorprocessor, use the fetch element"; +} + }
\ No newline at end of file diff --git a/src/uscxml/server/InterpreterServlet.h b/src/uscxml/server/InterpreterServlet.h index 72f2f67..18e1d28 100644 --- a/src/uscxml/server/InterpreterServlet.h +++ b/src/uscxml/server/InterpreterServlet.h @@ -2,15 +2,30 @@ #define INTERPRETERSERVLET_H_XQLWNMH4 #include "HTTPServer.h" +#include "uscxml/Factory.h" namespace uscxml { class Interpreter; -class InterpreterServlet : public HTTPServlet { +class InterpreterServlet : public HTTPServlet, public IOProcessorImpl { public: + InterpreterServlet() {}; InterpreterServlet(Interpreter* interpreter); virtual ~InterpreterServlet() {} + + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("http"); + names.insert("http://www.w3.org/TR/scxml/#HTTPEventProcessor"); + return names; + } + + Data getDataModelVariables(); + virtual void send(const SendRequest& req); + virtual void httpRecvRequest(const HTTPServer::Request& req); std::string getPath() { @@ -26,6 +41,7 @@ public: return false; } + std::map<std::string, HTTPServer::Request>& getRequests() { return _requests; } |