Adding cross-browser XMLHttpRequest functionality and convenience methods around it in the OpenLayers.Request namespace. Deprecating OpenLayers.Ajax.Request. Full support sync/async requests using all HTTP verbs now. r=elemoine (closes #1565)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7335 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-06-09 19:51:38 +00:00
parent c3ca41b3be
commit 3c70e78e47
18 changed files with 924 additions and 120 deletions
+6 -1
View File
@@ -100,7 +100,12 @@ OpenLayers.Layer.GML = OpenLayers.Class(OpenLayers.Layer.Vector, {
*/
loadGML: function() {
if (!this.loaded) {
var results = OpenLayers.loadURL(this.url, null, this, this.requestSuccess, this.requestFailure);
OpenLayers.Request.GET({
url: this.url,
success: this.requestSuccess,
failure: this.requestFailure,
scope: this
});
this.loaded = true;
}
},
+6 -2
View File
@@ -100,7 +100,11 @@ OpenLayers.Layer.GeoRSS = OpenLayers.Class(OpenLayers.Layer.Markers, {
loadRSS: function() {
if (!this.loaded) {
this.events.triggerEvent("loadstart");
OpenLayers.loadURL(this.location, null, this, this.parseData);
OpenLayers.Request.GET({
url: this.location,
success: this.parseData,
scope: this
});
this.loaded = true;
}
},
@@ -127,7 +131,7 @@ OpenLayers.Layer.GeoRSS = OpenLayers.Class(OpenLayers.Layer.Markers, {
* Parse the data returned from the Events call.
*
* Parameters:
* ajaxRequest - {XMLHttpRequest}
* ajaxRequest - {<OpenLayers.Request.XMLHttpRequest>}
*/
parseData: function(ajaxRequest) {
var doc = ajaxRequest.responseXML;
+4 -6
View File
@@ -202,12 +202,10 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, {
getVisParams.mapName = this.params.mapName;
getVisParams.format = 'text/xml';
getVisParams = OpenLayers.Util.extend(getVisParams, params);
new OpenLayers.Ajax.Request(this.url,
{ parameters: getVisParams,
method: 'get',
asynchronous: false //must be synchronous call to return control here
});
OpenLayers.Request.GET({
url: this.url, params: getVisParams, async: false
});
}
//construct the full URL
+7 -3
View File
@@ -109,8 +109,12 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
};
this.events.triggerEvent("loadstart");
OpenLayers.loadURL(this.location, null,
this, this.parseData, onFail);
OpenLayers.Request.GET({
url: this.location,
success: this.parseData,
failure: onFail,
scope: this
});
this.loaded = true;
}
}
@@ -137,7 +141,7 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
* Method: parseData
*
* Parameters:
* ajaxRequest - {XMLHttpRequest}
* ajaxRequest - {<OpenLayers.Request.XMLHttpRequest>}
*/
parseData: function(ajaxRequest) {
var text = ajaxRequest.responseText;
+7 -14
View File
@@ -455,21 +455,14 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
}
var data = this.writer.write(this.features);
var url = this.url;
var success = OpenLayers.Function.bind(this.commitSuccess, this);
var failure = OpenLayers.Function.bind(this.commitFailure, this);
// from prototype.js
new OpenLayers.Ajax.Request(url,
{ method: 'post',
postBody: data,
onComplete: success,
onFailure: failure
}
);
OpenLayers.Request.POST({
url: this.url,
data: data,
success: this.commitSuccess,
failure: this.commitFailure,
scope: this
});
},
/**