1 /** 2 * @class ProviderGETMakeRequest 3 * @extends ProviderGET 4 * @author suho@wso2.com 5 **/ 6 7 wso2vis.p.ProviderGETMakeRequest = function(url) { 8 wso2vis.p.ProviderGET.call(this, url); 9 }; 10 11 wso2vis.extend(wso2vis.p.ProviderGETMakeRequest, wso2vis.p.ProviderGET); 12 13 wso2vis.p.ProviderGETMakeRequest.prototype.pullData = function() { 14 // Make sure the XMLHttpRequest object was instantiated 15 var that = this; 16 17 var params = {}; 18 params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM; 19 var refreshInterval = 0; 20 var sep = "?"; 21 if (this.url.indexOf("nocache=") < 0) { 22 if (this.url.indexOf("?") > -1) { 23 sep = "&"; 24 } 25 this.url = [ this.url, sep, "nocache=", refreshInterval ].join(""); 26 } 27 28 gadgets.io.makeRequest(this.url,callback, params); 29 30 function callback(resp) { 31 that.parseResponse(resp, that); 32 } 33 34 } 35 36 wso2vis.p.ProviderGETMakeRequest.prototype.pullDataSync = function() { 37 var that = this; 38 var params = {}; 39 params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM; 40 var refreshInterval = 0; 41 var sep = "?"; 42 if (this.url.indexOf("nocache=") < 0) { 43 if (this.url.indexOf("?") > -1) { 44 sep = "&"; 45 } 46 this.url = [ this.url, sep, "nocache=", refreshInterval ].join(""); 47 } 48 49 gadgets.io.makeRequest(this.url,callback, params); 50 51 function callback(resp) { 52 that.parseResponse(resp, that); 53 } 54 return false; 55 } 56 57 wso2vis.p.ProviderGETMakeRequest.prototype.parseResponse = function(response, that) { 58 that.pushData( that.xmlToJson(response.data, " ")); 59 } 60 61 62