summaryrefslogtreecommitdiff
path: root/js/demo/Ice/hello/browser/Client.js
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2014-12-17 22:45:03 -0500
committerJoe George <joe@zeroc.com>2014-12-17 22:45:03 -0500
commitedea1bee5dad67a867ae056c089243102dfacaea (patch)
treec16d03f12ce04ace91190b2b0a22e2fe11f8163e /js/demo/Ice/hello/browser/Client.js
parentPartial fix for (ICE-6200) Improve Silverlight version detection (diff)
downloadice-edea1bee5dad67a867ae056c089243102dfacaea.tar.bz2
ice-edea1bee5dad67a867ae056c089243102dfacaea.tar.xz
ice-edea1bee5dad67a867ae056c089243102dfacaea.zip
ICE-6169 - Fix hello demos to only create new proxies if settings have changed
Diffstat (limited to 'js/demo/Ice/hello/browser/Client.js')
-rw-r--r--js/demo/Ice/hello/browser/Client.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/js/demo/Ice/hello/browser/Client.js b/js/demo/Ice/hello/browser/Client.js
index 7b2bb04e018..06206028d33 100644
--- a/js/demo/Ice/hello/browser/Client.js
+++ b/js/demo/Ice/hello/browser/Client.js
@@ -13,11 +13,12 @@ var communicator = Ice.initialize();
var flushEnabled = false;
var batch = 0;
+var helloPrx = null;
//
// Create the hello proxy.
//
-function createProxy()
+function updateProxy()
{
var hostname = document.location.hostname || "127.0.0.1";
var proxy = communicator.stringToProxy("hello" +
@@ -58,7 +59,7 @@ function createProxy()
{
proxy = proxy.ice_batchOneway().ice_secure(true);
}
- return Demo.HelloPrx.uncheckedCast(proxy);
+ helloPrx = Demo.HelloPrx.uncheckedCast(proxy);
}
//
@@ -68,13 +69,12 @@ function sayHello()
{
setState(State.SendRequest);
- var proxy = createProxy();
- if(proxy.ice_isBatchOneway())
+ if(helloPrx.ice_isBatchOneway())
{
batch++;
}
- return proxy.sayHello($("#delay").val());
+ return helloPrx.sayHello($("#delay").val());
}
//
@@ -94,13 +94,12 @@ function shutdown()
{
setState(State.SendRequest);
- var proxy = createProxy();
- if(proxy.ice_isBatchOneway())
+ if(helloPrx.ice_isBatchOneway())
{
batch++;
}
- return proxy.shutdown();
+ return helloPrx.shutdown();
}
//
@@ -260,6 +259,24 @@ $("#mode").on("change",
href = href.replace("8080", "9090");
document.location.assign(href);
}
+ else if (document.location.protocol === "https:" &&
+ (newMode === "twoway" || newMode === "oneway" || newMode === "oneway-batch"))
+ {
+ var href = document.location.protocol + "//" + document.location.host +
+ document.location.pathname + "?mode=" + newMode;
+ href = href.replace("https", "http");
+ href = href.replace("9090", "8080");
+ document.location.assign(href);
+ }
+ console.log(newMode);
+ updateProxy();
+ });
+
+$("#timeout").on("change",
+ function(e)
+ {
+ updateProxy();
});
+updateProxy();
}());