svn commit r20364 - trunk/wsf/javascript/native/src

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

svn commit r20364 - trunk/wsf/javascript/native/src

Jonathan Marsh-2
Author: jonathan
Date: Mon Aug  4 17:09:16 2008
New Revision: 20364
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20364

Log:
MASHUP-1055: Added proxyAddress and proxyEngagedCallback properties to WSRequest, supporting script injection on non-http domains.

Modified:
   trunk/wsf/javascript/native/src/WSRequest.js

Modified: trunk/wsf/javascript/native/src/WSRequest.js
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/javascript/native/src/WSRequest.js?rev=20364&r1=20363&r2=20364&view=diff
==============================================================================
--- trunk/wsf/javascript/native/src/WSRequest.js (original)
+++ trunk/wsf/javascript/native/src/WSRequest.js Mon Aug  4 17:09:16 2008
@@ -26,6 +26,9 @@
     this.responseXML = null;
     this.error = null;
     this.onreadystatechange = null;
+    this.proxyAddress = null;
+    this.proxyEngagedCallback = null;
+
     // Some internal properties
     this._xmlhttp = WSRequest.util._createXMLHttpRequestObject();
     this._soapVer = null;
@@ -216,7 +219,14 @@
 
         var scriptId = Math.random().toString().substring(3);
 
-        var tunnelDomain = this._uri.substring(0,this._uri.indexOf("/services/"));
+        var tunnelDomain;
+        if (this.proxyAddress == null) {
+            if (this._uri.indexOf("http") == 0)
+                tunnelDomain = this._uri.substring(0,this._uri.indexOf("/services/"));
+            else throw new WebServiceError("Unspecified WSRequest.proxyAddress property - must specify when using script-injection fallback when endpoint is not http or https.")
+        } else {
+            tunnelDomain = this.proxyAddress;
+        }
         var tunnelEndpoint = tunnelDomain + "/WSRequestXSSproxy.jsp";
         var response = scriptId + "," +
                        this._async.toString() + "," +
@@ -249,6 +259,11 @@
         head.appendChild(script);
 
     }
+
+    // Execute a simple callback enabling UI to reflect whether the call was normal or through the proxy.
+    if (this.proxyEngagedCallback != null)
+        this.proxyEngagedCallback(!accessibleDomain);
+
 }
 
 WSRequest._tunnelcallback = function (scriptId, responseText) {

_______________________________________________
Wsf-javascript-dev mailing list
[hidden email]
http://mailman.wso2.org/cgi-bin/mailman/listinfo/wsf-javascript-dev
Loading...