summaryrefslogtreecommitdiff
path: root/swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2006-12-31 20:12:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:35:23 -0500
commitd1e09e2e6f9db62bbab84abb53e23ee73764178a (patch)
tree18e57f756611c9d3e10fb41bf7c09eeb795028dd /swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html
parent710dfce70ca9024d2f026518638bb193e914f4a0 (diff)
downloadsamba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.gz
samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.bz2
samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.zip
r20446: rename swat directory to swat.obsolete; keeping it around since there is lots of useful info in it.
(This used to be commit 5f9f72a9cfab80561b23284001b67c4ea961757b)
Diffstat (limited to 'swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html')
-rw-r--r--swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html133
1 files changed, 133 insertions, 0 deletions
diff --git a/swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html b/swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html
new file mode 100644
index 0000000000..44ce5c256b
--- /dev/null
+++ b/swat.obsolete/apps/qooxdoo-examples/test/RPC_2.html
@@ -0,0 +1,133 @@
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>qooxdoo &raquo; Demo</title>
+ <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
+ <!--[if IE]>
+ <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
+ <![endif]-->
+ <script type="text/javascript" src="../../script/qx.js"></script>
+ <script type="text/javascript" src=".qxrpc"></script>
+ <!-- With the above script, the service URL for a J2EE application can be
+ automatically determined, no matter on what path it's deployed. -->
+</head>
+<body>
+ <script type="text/javascript" src="../../script/layout.js"></script>
+
+ <div id="demoDescription">
+ <p>Test for RPC functionality.</p>
+ <p>
+ This tests the ability to issue multiple asynchronous RPC calls to the
+ same service/method, and determine from which request we have received a
+ response. We issue multiple 'sleep' calls, for decreasing amounts of
+ time, and ensure that we can associate the resonses from the
+ later-issued requests to the earlier-received responses.
+ </p>
+ </div>
+
+ <script type="text/javascript">
+// qx.Settings.setCustomOfClass("qx.io.remote.RemoteExchange", "enableDebug", true);
+ qx.Settings.setCustomOfClass("qx.io.Json", "enableDebug", true);
+
+ qx.core.Init.getInstance().defineMain(function() {
+ var layout1 = new qx.ui.layout.VerticalBoxLayout();
+ layout1.setTop(40);
+ layout1.setLeft(20);
+ layout1.setSpacing(4);
+
+ /*
+ * Sigh. Both IE and Firefox follow (too strictly) RFC2616 and limit
+ * the number of simultaneous asyncronous HTTP requests to 2. We'll
+ * allow testing just 2 simultaneous requests or issuing 6 simultaneous
+ * requests. In the former case, we'll get expected results. In the
+ * latter, we'll see two at a time being processed.
+ *
+ * Note that this applies to both XmlHTTPTransport and IframeTransport.
+ * It is an HTTP limitation, not a limitation of a particular method of
+ * issuing a request.
+ */
+ var tooMany = new qx.ui.form.CheckBox("Issue more requests than IE's and Firefox's implementations of HTTP will process simultaneously");
+ layout1.add(tooMany);
+
+ var crossDomain = new qx.ui.form.CheckBox("Cross Domain");
+ layout1.add(crossDomain);
+
+ layout1.add(new qx.ui.basic.Label("URL:"));
+ var defaultURL = qx.io.remote.Rpc.makeServerURL();
+ if (defaultURL == null) {
+ defaultURL = "/services/";
+ }
+ var url = new qx.ui.form.TextField(defaultURL);
+ layout1.add(url);
+
+ layout1.add(new qx.ui.basic.Label("Service:"));
+ var service = new qx.ui.form.TextField("qooxdoo.test");
+ layout1.add(service);
+
+ var layout2 = new qx.ui.layout.HorizontalBoxLayout();
+ layout2.setHeight("auto");
+ layout2.setVerticalChildrenAlign("middle");
+ layout2.setSpacing(4);
+ var start = new qx.ui.form.Button("Start Test");
+ layout2.add(start);
+ var abort = new qx.ui.form.Button("Abort");
+ layout2.add(abort);
+ layout1.add(layout2);
+
+ // ensure there's room in the queue for all of our requests
+ qx.io.remote.RemoteRequestQueue.getInstance().setMaxConcurrentRequests(8);
+
+ // We'll be setting url and service upon execute; no need to do it now.
+ var rpc = new qx.io.remote.Rpc();
+ rpc.setTimeout(60000);
+ var mycall;
+ var mycalls = [];
+
+ start.addEventListener("execute", function() {
+ t0 = new Date().getTime();
+
+ rpc.setCrossDomain(crossDomain.isChecked());
+
+ rpc.setUrl(url.getValue());
+ rpc.setServiceName(service.getValue());
+
+ var seqnum;
+ for (i=(tooMany.isChecked() ? 30 : 10); i > 0; i-=5) {
+ /*
+ * Always issue an asynchronous request! Issuing a synchronous
+ * request can lock up the entire browser until a response is
+ * received. Bad browser developers! Bad!
+ */
+ mycall = rpc.callAsync(function(result, ex, seqnum) {
+ mycalls[seqnum] = null;
+ t = new Date().getTime() - t0;
+ if (ex == null) {
+ layout1.warn(t + ": response " + seqnum + ": " + result);
+ } else {
+ layout1.warn(t + ": exception " + seqnum + ": " + ex);
+ }
+ }, "sleep", i.toString()); // FIXME: Why is this sent as a string?
+
+ t = new Date().getTime() - t0;
+ seqnum = mycall.getSequenceNumber();
+ mycalls[seqnum] = mycall;
+ layout1.warn(t + ": request " + seqnum + " = " + i.toString());
+ }
+ });
+
+ abort.addEventListener("execute", function() {
+ for (seqnum in mycalls) {
+ if (mycalls[seqnum] !== null) {
+ rpc.abort(mycalls[seqnum]);
+ mycalls[seqnum] = null;
+ }
+ }
+ mycalls = [];
+ });
+
+ var d = qx.ui.core.ClientDocument.getInstance();
+ d.add(layout1);
+ });
+ </script>
+</body>
+</html>