You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by vs...@apache.org on 2009/04/01 14:56:01 UTC
svn commit: r760873 -
/incubator/shindig/trunk/features/src/main/javascript/features/core.io/io.js
Author: vsiveton
Date: Wed Apr 1 12:55:56 2009
New Revision: 760873
URL: http://svn.apache.org/viewvc?rev=760873&view=rev
Log:
SHINDIG-848: core.io/io.js does not look at the return code from the request
Submitted by: Henning Schmiedehausen
o patch applied
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/core.io/io.js
Modified: incubator/shindig/trunk/features/src/main/javascript/features/core.io/io.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/core.io/io.js?rev=760873&r1=760872&r2=760873&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/core.io/io.js (original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/core.io/io.js Wed Apr 1 12:55:56 2009
@@ -97,7 +97,8 @@
return;
}
var data = {
- body: xobj.responseText
+ body: xobj.responseText,
+ rc: 200
};
callback(transformResponseData(params, data));
}
@@ -144,41 +145,46 @@
oauthErrorText: data.oauthErrorText,
errors: []
};
- if (resp.text) {
- switch (params.CONTENT_TYPE) {
- case "JSON":
- case "FEED":
- resp.data = gadgets.json.parse(resp.text);
- if (!resp.data) {
- resp.errors.push("failed to parse JSON");
- resp.data = null;
- }
- break;
- case "DOM":
- var dom;
- if (window.ActiveXObject) {
- dom = new ActiveXObject("Microsoft.XMLDOM");
- dom.async = false;
- dom.validateOnParse = false;
- dom.resolveExternals = false;
- if (!dom.loadXML(resp.text)) {
- resp.errors.push("failed to parse XML");
- } else {
- resp.data = dom;
+ if (resp.rc === 200) {
+ if (resp.text) {
+ switch (params.CONTENT_TYPE) {
+ case "JSON":
+ case "FEED":
+ resp.data = gadgets.json.parse(resp.text);
+ if (!resp.data) {
+ resp.errors.push("failed to parse JSON");
+ resp.data = null;
}
- } else {
- var parser = new DOMParser();
- dom = parser.parseFromString(resp.text, "text/xml");
- if ("parsererror" === dom.documentElement.nodeName) {
- resp.errors.push("failed to parse XML");
+ break;
+ case "DOM":
+ var dom;
+ if (window.ActiveXObject) {
+ dom = new ActiveXObject("Microsoft.XMLDOM");
+ dom.async = false;
+ dom.validateOnParse = false;
+ dom.resolveExternals = false;
+ if (!dom.loadXML(resp.text)) {
+ resp.errors.push("failed to parse XML");
+ } else {
+ resp.data = dom;
+ }
} else {
- resp.data = dom;
+ var parser = new DOMParser();
+ dom = parser.parseFromString(resp.text, "text/xml");
+ if ("parsererror" === dom.documentElement.nodeName) {
+ resp.errors.push("failed to parse XML");
+ } else {
+ resp.data = dom;
+ }
}
- }
- break;
- default:
- resp.data = resp.text;
- break;
+ break;
+ default:
+ resp.data = resp.text;
+ break;
+ }
+ } else {
+ resp.errors.push("failed to retrieve data from backend");
+ resp.data = null;
}
}
return resp;