summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/ioprocessor
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-01-14 16:15:09 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-01-14 16:15:09 (GMT)
commit836927aa902696297febc95132e2c82147c08c03 (patch)
tree64bcbaa67c6f70acdb5f4cc9184f600fad46b826 /src/uscxml/plugins/ioprocessor
parentf7ca1ebaa5a527f817892bc3794452df1a6c20c6 (diff)
downloaduscxml-836927aa902696297febc95132e2c82147c08c03.zip
uscxml-836927aa902696297febc95132e2c82147c08c03.tar.gz
uscxml-836927aa902696297febc95132e2c82147c08c03.tar.bz2
Expect Invoker and Fedora build fixes
Diffstat (limited to 'src/uscxml/plugins/ioprocessor')
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 1b3eff0..7a24c79 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -21,6 +21,7 @@
#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
#include "uscxml/Message.h"
+#include "uscxml/DOMUtils.h"
#include <iostream>
#include <event2/dns.h>
#include <event2/buffer.h>
@@ -85,8 +86,26 @@ boost::shared_ptr<IOProcessorImpl> BasicHTTPIOProcessor::create(InterpreterImpl*
Data BasicHTTPIOProcessor::getDataModelVariables() {
Data data;
- assert(_url.length() > 0);
+
+ // we are not connected!
+ if(_url.length() == 0)
+ return data;
+
data.compound["location"] = Data(_url, Data::VERBATIM);
+
+ URL url(_url);
+ data.compound["host"] = Data(url.host(), Data::VERBATIM);
+ data.compound["port"] = Data(url.port(), Data::VERBATIM);
+ data.compound["path"] = Data(url.path(), Data::VERBATIM);
+ data.compound["scheme"] = Data(url.scheme(), Data::VERBATIM);
+
+ std::vector<std::string> pathComps = url.pathComponents();
+ std::vector<std::string>::const_iterator pathCompIter = pathComps.begin();
+ while(pathCompIter != pathComps.end()) {
+ data.compound["pathComponens"].array.push_back(Data(*pathCompIter, Data::VERBATIM));
+ pathCompIter++;
+ }
+
return data;
}
@@ -94,10 +113,29 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
Event reqEvent = req;
reqEvent.eventType = Event::EXTERNAL;
+// std::cout << req.raw << std::endl;
+
+ /**
+ * If a single instance of the parameter '_scxmleventname' is present, the
+ * SCXML Processor must use its value as the name of the SCXML event that it
+ * raises.
+ */
+
// this will call the const subscript operator
if (req.data["content"]["_scxmleventname"]) {
reqEvent.name = req.data["content"]["_scxmleventname"].atom;
}
+ if (req.data["content"]["content"]) {
+ reqEvent.content = req.data["content"]["content"].atom;
+ }
+
+ // check whether we can parse it as XML
+ if (reqEvent.content.length() > 0) {
+ NameSpacingParser parser = NameSpacingParser::fromXML(reqEvent.content);
+ if (!parser.errorsReported()) {
+ reqEvent.dom = parser.getDocument();
+ }
+ }
/// test532
if (reqEvent.name.length() == 0)