diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-28 17:26:38 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-28 17:26:38 (GMT) |
commit | a68b6c1d31cb94675dd4dda0a2da11d8e83063c3 (patch) | |
tree | d96b56f209f2b65c703be4e611a7e3e6da899067 /apps/samples | |
parent | 1be1af2d15375dbbf20cd07e85afdf3cee23c992 (diff) | |
download | uscxml-a68b6c1d31cb94675dd4dda0a2da11d8e83063c3.zip uscxml-a68b6c1d31cb94675dd4dda0a2da11d8e83063c3.tar.gz uscxml-a68b6c1d31cb94675dd4dda0a2da11d8e83063c3.tar.bz2 |
Bug fixes (see details)
- No more 100-continue HTTP header
- Correctly delegate HTTP requests
- More elaborate expressions when communicating via HTTP
- Fixed off-by-one in JSCNodeSet
Diffstat (limited to 'apps/samples')
-rw-r--r-- | apps/samples/put-that-there/put-that-there.scxml | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/apps/samples/put-that-there/put-that-there.scxml b/apps/samples/put-that-there/put-that-there.scxml index b608972..43a6b37 100644 --- a/apps/samples/put-that-there/put-that-there.scxml +++ b/apps/samples/put-that-there/put-that-there.scxml @@ -1,6 +1,7 @@ -<scxml datamodel="ecmascript" initial="start" binding="late" +<scxml datamodel="ecmascript" initial="start" binding="late" name="ptt" xmlns="http://www.w3.org/2005/07/scxml" xmlns:scenegraph="http://uscxml.tk.informatik.tu-darmstadt.de/scenegraph.xsd"> + <script src="http://uscxml.tk.informatik.tu-darmstadt.de/scripts/dump.js" /> <state id="start"> <invoke type="scenegraph"> <content> @@ -25,5 +26,46 @@ </scenegraph:display> </content> </invoke> + <state id="main"> + <transition event="http" target="main" type="internal" + cond="_event.data.pathComponent[1] === 'basichttp' && _event.data.pathComponent[2] === 'query'" > + <!-- a request for /ptt/basichttp/query --> + <script>dump(_event);</script> + <if cond="_event.data.header['X-XPath']"> + <script> + // a xpath query, evaluate, check for result and set reply on event + var nodes = document.evaluate(_event.data.header['X-XPath']); + if (nodes.asNodeSet().size > 0) { + _event.reply = nodes.asNodeSet()[0]; + } else { + _event.reply = "No nodes!"; + } + </script> + </if> + <send type="basichttp" targetexpr="_event.data.header['X-Reply-To']"> + <content expr="_event.reply" /> + </send> + </transition> + + <transition event="http" target="main" type="internal" + cond="_event.data.pathComponent[1] === 'query'" > + <!-- a request for /ptt/query --> + <script>dump(_event);</script> + <if cond="_event.data.header['X-XPath']"> + <script> + // a xpath query, evaluate, check for result and set reply on event + var nodes = document.evaluate(_event.data.header['X-XPath']); + if (nodes.asNodeSet().size > 0) { + _event.reply = nodes.asNodeSet()[0]; + } else { + _event.reply = "No nodes!"; + } + </script> + </if> + <respond to="_event.origin"> + <content expr="_event.reply" /> + </respond> + </transition> + </state> </state> </scxml>
\ No newline at end of file |