summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/element/respond
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-09-18 15:39:30 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-09-18 15:39:30 (GMT)
commit8dde1311719b29c63efb379566916cb1aa9a7cd7 (patch)
tree6849ab145936ea5a2bebee5b64e69c4d226c3810 /src/uscxml/plugins/element/respond
parent7938e286967597c7168b855b7e3fdfbd9b949e0e (diff)
downloaduscxml-8dde1311719b29c63efb379566916cb1aa9a7cd7.zip
uscxml-8dde1311719b29c63efb379566916cb1aa9a7cd7.tar.gz
uscxml-8dde1311719b29c63efb379566916cb1aa9a7cd7.tar.bz2
Work on FFMpegInvoker
Diffstat (limited to 'src/uscxml/plugins/element/respond')
-rw-r--r--src/uscxml/plugins/element/respond/RespondElement.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/uscxml/plugins/element/respond/RespondElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp
index 3c47b83..ae81fed 100644
--- a/src/uscxml/plugins/element/respond/RespondElement.cpp
+++ b/src/uscxml/plugins/element/respond/RespondElement.cpp
@@ -63,8 +63,14 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
if (HAS_ATTR(contents[0], "expr")) { // -- content is evaluated string from datamodel ------
if (_interpreter->getDataModel()) {
try {
- std::string contentValue = _interpreter->getDataModel().evalAsString(ATTR(contents[0], "expr"));
- httpReply.content = contentValue;
+ Data contentData = _interpreter->getDataModel().getStringAsData(ATTR(contents[0], "expr"));
+ if (contentData.atom.length() > 0) {
+ httpReply.content = contentData.atom;
+ } else if (contentData.binary) {
+ httpReply.content = std::string(contentData.binary->_data, contentData.binary->_size);
+ } else {
+ httpReply.content = Data::toJSON(contentData);
+ }
} catch (Event e) {
LOG(ERROR) << "Syntax error with expr in content child of Respond element:" << std::endl << e << std::endl;
return;
@@ -132,20 +138,20 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
std::string value;
if (HAS_ATTR(headers[i], "value")) {
value = ATTR(headers[i], "value");
- } else if(HAS_ATTR(headers[i], "expr")) {
+ } else if(HAS_ATTR(headers[i], "valueexpr")) {
if (_interpreter->getDataModel()) {
try {
- value = _interpreter->getDataModel().evalAsString(ATTR(headers[i], "expr"));
+ value = _interpreter->getDataModel().evalAsString(ATTR(headers[i], "valueexpr"));
} catch (Event e) {
- LOG(ERROR) << "Syntax error with expr in header child of Respond element:" << std::endl << e << std::endl;
+ LOG(ERROR) << "Syntax error with valueexpr in header child of Respond element:" << std::endl << e << std::endl;
return;
}
} else {
- LOG(ERROR) << "header element has expr attribute but no datamodel is specified.";
+ LOG(ERROR) << "header element has valueexpr attribute but no datamodel is specified.";
return;
}
} else {
- LOG(ERROR) << "header element has no value or expr attribute.";
+ LOG(ERROR) << "header element has no value or valueexpr attribute.";
return;
}