X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..6e39d509471fe9b4e2660e0d1631b350d0c66f40:/docs/source/Api.html diff --git a/docs/source/Api.html b/docs/source/Api.html index 5c7c57e4..b20cb47e 100644 --- a/docs/source/Api.html +++ b/docs/source/Api.html @@ -1,11 +1,13 @@ + The source code -
/** +
+
/** * @class Ext.data.Api * @extends Object * Ext.data.Api is a singleton designed to manage the data API including methods @@ -169,7 +171,8 @@ new Ext.data.HttpProxy({ proxy.api[action] = proxy.api[action] || proxy.url || proxy.directFn; if (typeof(proxy.api[action]) == 'string') { proxy.api[action] = { - url: proxy.api[action] + url: proxy.api[action], + method: (proxy.restful === true) ? Ext.data.Api.restActions[action] : undefined }; } } @@ -189,28 +192,32 @@ new Ext.data.HttpProxy({ // to satisfy initial 3.0 final release of REST features. proxy.onWrite = proxy.onWrite.createInterceptor(function(action, o, response, rs) { var reader = o.reader; - var res = {}; + var res = new Ext.data.Response({ + action: action, + raw: response + }); + switch (response.status) { - case 200: // standard 200 response, send control back to HttpProxy#onWrite + case 200: // standard 200 response, send control back to HttpProxy#onWrite by returning true from this intercepted #onWrite return true; break; case 201: // entity created but no response returned - res[reader.meta.successProperty] = true; + res.success = true; break; case 204: // no-content. Create a fake response. - res[reader.meta.successProperty] = true; - res[reader.meta.root] = null; + res.success = true; + res.data = null; break; default: return true; break; } - if (res[reader.meta.successProperty] === true) { - this.fireEvent("write", this, action, res[reader.meta.root], res, rs, o.request.arg); + if (res.success === true) { + this.fireEvent("write", this, action, res.data, res, rs, o.request.arg); } else { this.fireEvent('exception', this, 'remote', action, o, res, rs); } - o.request.callback.call(o.request.scope, res[reader.meta.root], res, res[reader.meta.successProperty]); + o.request.callback.call(o.request.scope, res.data, res, res.success); return false; // <-- false to prevent intercepted function from running. }, proxy); @@ -218,6 +225,39 @@ new Ext.data.HttpProxy({ }; })(); +
/** + * Ext.data.Response + * Experimental. Do not use directly. + */ +Ext.data.Response = function(params, response) { + Ext.apply(this, params, { + raw: response + }); +}; +Ext.data.Response.prototype = { + message : null, + success : false, + status : null, + root : null, + raw : null, + + getMessage : function() { + return this.message; + }, + getSuccess : function() { + return this.success; + }, + getStatus : function() { + return this.status + }, + getRoot : function() { + return this.root; + }, + getRawResponse : function() { + return this.raw; + } +}; +
/** * @class Ext.data.Api.Error * @extends Ext.Error @@ -238,6 +278,8 @@ Ext.apply(Ext.data.Api.Error.prototype, { 'execute': 'Attempted to execute an unknown action. Valid API actions are defined in Ext.data.Api.actions"' } }); + +
\ No newline at end of file