applying patch for #399 - MultiServer - some small formatting/commenting changes.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1872 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -109,6 +109,12 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
// use layer's url unless altUrl passed in
|
||||
var url = (altUrl == null) ? this.url : altUrl;
|
||||
|
||||
// if url is not a string, it should be an array of strings,
|
||||
// in which case we will randomly select one of them in order
|
||||
// to evenly distribute requests to different urls.
|
||||
if (typeof url == "object") {
|
||||
url = url[Math.floor(Math.random()*url.length)];
|
||||
}
|
||||
// requestString always starts with url
|
||||
var requestString = url;
|
||||
|
||||
@@ -117,13 +123,12 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
var allParams = OpenLayers.Util.extend(new Object(), this.params);
|
||||
var allParams = OpenLayers.Util.extend(allParams, newParams);
|
||||
var paramsString = OpenLayers.Util.getParameterString(allParams);
|
||||
|
||||
if (paramsString != "") {
|
||||
var lastServerChar = this.url.charAt(this.url.length - 1);
|
||||
var lastServerChar = url.charAt(url.length - 1);
|
||||
if ((lastServerChar == "&") || (lastServerChar == "?")) {
|
||||
requestString += paramsString;
|
||||
} else {
|
||||
if (this.url.indexOf('?') == -1) {
|
||||
if (url.indexOf('?') == -1) {
|
||||
//serverPath has no ? -- add one
|
||||
requestString += '?' + paramsString;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user