Author: isuru
Date: Mon Dec  1 10:15:29 2008
New Revision: 25424
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=25424

Log:
Simple fix for chad sample



Modified:
   trunk/wsas/java/carbon/samples/Chad/www/js/chad.js

Modified: trunk/wsas/java/carbon/samples/Chad/www/js/chad.js
URL: 
http://wso2.org/svn/browse/wso2/trunk/wsas/java/carbon/samples/Chad/www/js/chad.js?rev=25424&r1=25423&r2=25424&view=diff
==============================================================================
--- trunk/wsas/java/carbon/samples/Chad/www/js/chad.js  (original)
+++ trunk/wsas/java/carbon/samples/Chad/www/js/chad.js  Mon Dec  1 10:15:29 2008
@@ -41,7 +41,10 @@
 
 /*Chad's constrctor */
 wso2.wsas.Chad = function() {
-    wso2.wsf.Util.initURLs();
+    var host = getHost();
+    if (host == null) {
+        host = "localhost";
+    }
     this.req = null;
     this._options = new Object();
     this._options["useBindng"] = "SOAP 1.1";
@@ -49,10 +52,10 @@
     this.onError = null;
 
     var temp = wso2.wsf.Util.getProtocol();
-    var serverURLMy = "http://localhost:9763/services";;
+    var serverURLMy = "http://"; + host + ":9763/services";
     if (temp) {
         if (temp == "https") {
-            serverURLMy = "https://localhost:9443/services";;
+            serverURLMy = "https://"; + host + ":9443/services";
         }
     }
 
@@ -739,4 +742,20 @@
             this.viewPollDetailsForVoted(this.getCurrentPollId());
         }
     }
-}
\ No newline at end of file
+}
+
+function getHost() {
+    var locationHref = self.location.href;
+    var host
+
+    var tmp1 = locationHref.indexOf("://");
+    var tmp2 = locationHref.substring(tmp1 + 3);
+    var tmp3 = tmp2.indexOf(":");
+    if (tmp3 > -1) {
+        host = tmp2.substring(0, tmp3);
+    } else {
+        tmp3 = tmp2.indexOf("/");
+        host = tmp2.substring(0, tmp3);
+    }
+    return host;
+}

_______________________________________________
Wsas-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev

Reply via email to