You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2006/10/11 01:07:06 UTC
svn commit: r462654 -
/incubator/xap/trunk/src/xap/requestservice/RequestService.js
Author: jmargaris
Date: Tue Oct 10 18:07:06 2006
New Revision: 462654
URL: http://svn.apache.org/viewvc?view=rev&rev=462654
Log:
Don't barf if listener in asynch calls is blank
Modified:
incubator/xap/trunk/src/xap/requestservice/RequestService.js
Modified: incubator/xap/trunk/src/xap/requestservice/RequestService.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/requestservice/RequestService.js?view=diff&rev=462654&r1=462653&r2=462654
==============================================================================
--- incubator/xap/trunk/src/xap/requestservice/RequestService.js (original)
+++ incubator/xap/trunk/src/xap/requestservice/RequestService.js Tue Oct 10 18:07:06 2006
@@ -88,16 +88,18 @@
xap.requestservice.RequestService.prototype.retrieveAndProcessAsynchronously = function(url, listener) {
var self = this;
var callback = function(response) {
- if (response.status == xap.util.HttpUtils.OK) {
- try{
- self._processXmlString(response.responseText);
- listener.requestCompleted(url, response);
+ if (listener){
+ if (response.status == xap.util.HttpUtils.OK) {
+ try{
+ self._processXmlString(response.responseText);
+ listener.requestCompleted(url, response);
+ }
+ catch(e){
+ listener.requestFailed(url, response, e);
+ }
+ } else {
+ listener.requestFailed(url, response);
}
- catch(e){
- listener.requestFailed(url, response, e);
- }
- } else {
- listener.requestFailed(url, response);
}
};
xap.util.HttpUtils.get(url, callback);
@@ -132,11 +134,13 @@
*/
xap.requestservice.RequestService.prototype.retrieveAsynchronously = function(url, listener) {
var callback = function( response ) {
- if (response.status == xap.util.HttpUtils.OK) {
- listener.requestCompleted(url, response);
- } else {
- listener.requestFailed(url, response);
- }
+ if (listener){
+ if (response.status == xap.util.HttpUtils.OK) {
+ listener.requestCompleted(url, response);
+ } else {
+ listener.requestFailed(url, response);
+ }
+ }
};
xap.util.HttpUtils.get(url, callback);
}