cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r689100 - in /cxf/branches/2.1.x-fixes: ./ rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
Date Tue, 26 Aug 2008 14:47:24 GMT
Author: dkulp
Date: Tue Aug 26 07:47:24 2008
New Revision: 689100

URL: http://svn.apache.org/viewvc?rev=689100&view=rev
Log:
Merged revisions 687891 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r687891 | bimargulies | 2008-08-21 19:04:24 -0400 (Thu, 21 Aug 2008) | 2 lines
  
  address CXF-1575.
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 26 07:47:24 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Aug 26 07:47:24 2008
@@ -1 +1 @@
-/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817
+/cxf/trunk:1-686342,686344-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js?rev=689100&r1=689099&r2=689100&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/resources/org/apache/cxf/javascript/cxf-utils.js
Tue Aug 26 07:47:24 2008
@@ -605,12 +605,69 @@
 	return null;
 }
 
+//
+// Returns XMLHttpRequest object.
+//
+var ORG_APACHE_CXF_XMLHTTPREQUEST_MS_PROGIDS = new Array(
+    "Msxml2.XMLHTTP.7.0",
+    "Msxml2.XMLHTTP.6.0",
+    "Msxml2.XMLHTTP.5.0",
+    "Msxml2.XMLHTTP.4.0",
+    "MSXML2.XMLHTTP.3.0",
+    "MSXML2.XMLHTTP",
+    "Microsoft.XMLHTTP"
+    );    
+
+function org_apache_cxf_getXMLHttpRequest()
+{
+    var httpRequest = null;
+ 
+    // Create the appropriate HttpRequest object for the browser.
+    try {
+        httpRequest = new XMLHttpRequest();
+        return httpRequest;
+    } catch(ex) {
+    }
+    
+    if (window.ActiveXObject != null) {
+        // Must be IE, find the right ActiveXObject.
+   
+        var success = false;
+        //
+        // Define a list of Microsoft XML HTTP ProgIDs.
+        //
+        for (var i = 0;
+             i < ORG_APACHE_CXF_XMLHTTPREQUEST_MS_PROGIDS.length && !success;
+             i++)
+        {
+            try
+            {
+                httpRequest = new ActiveXObject(ORG_APACHE_CXF_XMLHTTPREQUEST_MS_PROGIDS[i]);
+                success = true;
+            }
+            catch (ex)
+            {
+                // no reason to log unless we come up empty.
+            }
+        }
+        if(!success) {
+            this.utils.trace("Unable to get any Microsoft XML HttpRequest object.");
+            throw "org_apache_cxf no Microsoft XMLHttpRequest";
+        }
+    }
+    // Return it.
+    return httpRequest;
+}
+
+CxfApacheOrgClient.prototype.getXMLHttpRequest = org_apache_cxf_getXMLHttpRequest;
+
 var ORG_APACHE_CXF_MTOM_REQUEST_HEADER = 'Content-Type: application/xop+xml; type="text/xml";
charset=utf-8\r\n';
 
 // Caller must avoid stupid mistakes like 'GET' with a request body.
 // This does not support attempts to cross-script.
 // This imposes a relatively straightforward set of HTTP options.
-function org_apache_cxf_client_request(url, requestXML, method, sync, headers) {
+function org_apache_cxf_client_request(url, requestXML, method, sync, headers) 
+{
 	this.utils.trace("request " + url);
 
 	this.url = url;
@@ -628,21 +685,13 @@
 	}
 
 	try {
-		this.req = new XMLHttpRequest();
+		this.req = this.getXMLHttpRequest();
 	} catch (err) {
-		this.utils.trace("Error creating XMLHttpRequest " + err);
+		this.utils.trace("Error creating XMLHttpRequest: " + err);
 		this.req = null;
 	}
 
 	if (this.req == null) {
-		if (window.ActiveXObject) {
-			this.req = new ActiveXObject("MSXML2.XMLHTTP.6.0"); // Microsoft's
-			// recommended
-			// version
-		}
-	}
-
-	if (this.req == null) {
 		this.utils.trace("Unable to create request object.");
 		throw "ORG_APACHE_CXF_NO_REQUEST_OBJECT";
 	}



Mime
View raw message