diff options
author | Andrew Dolgov <[email protected]> | 2013-04-02 20:06:16 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-04-02 20:06:16 +0400 |
commit | 870334be3f58507c05bfc72f3edbe5db10af4caf (patch) | |
tree | 441e1c41780eb75d422025cabea17724e2cc4a79 /lib/dojo/rpc | |
parent | 7caa48fe6a3a37bd08f846f90e407ef31171f12c (diff) |
remove dojo uncompressed files
Diffstat (limited to 'lib/dojo/rpc')
-rw-r--r-- | lib/dojo/rpc/JsonService.js.uncompressed.js | 87 | ||||
-rw-r--r-- | lib/dojo/rpc/JsonpService.js.uncompressed.js | 66 | ||||
-rw-r--r-- | lib/dojo/rpc/RpcService.js.uncompressed.js | 178 |
3 files changed, 0 insertions, 331 deletions
diff --git a/lib/dojo/rpc/JsonService.js.uncompressed.js b/lib/dojo/rpc/JsonService.js.uncompressed.js deleted file mode 100644 index 07c16d545..000000000 --- a/lib/dojo/rpc/JsonService.js.uncompressed.js +++ /dev/null @@ -1,87 +0,0 @@ -define("dojo/rpc/JsonService", [ - "../_base/declare", "../_base/Deferred", "../_base/json", "../_base/lang", "../_base/xhr", - "./RpcService" -], function(declare, Deferred, json, lang, xhr, RpcService){ - - // module: - // dojo/rpc/JsonService - - return declare("dojo.rpc.JsonService", RpcService, { - // summary: - // TODOC - - bustCache: false, - contentType: "application/json-rpc", - lastSubmissionId: 0, - - callRemote: function(method, params){ - // summary: - // call an arbitrary remote method without requiring it to be - // predefined with SMD - // method: string - // the name of the remote method you want to call. - // params: array - // array of parameters to pass to method - - var deferred = new Deferred(); - this.bind(method, params, deferred); - return deferred; - }, - - bind: function(method, parameters, deferredRequestHandler, url){ - // summary: - // JSON-RPC bind method. Takes remote method, parameters, - // deferred, and a url, calls createRequest to make a JSON-RPC - // envelope and passes that off with bind. - // method: string - // The name of the method we are calling - // parameters: array - // The parameters we are passing off to the method - // deferredRequestHandler: deferred - // The Deferred object for this particular request - - var def = xhr.post({ - url: url||this.serviceUrl, - postData: this.createRequest(method, parameters), - contentType: this.contentType, - timeout: this.timeout, - handleAs: "json-comment-optional" - }); - def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler)); - }, - - createRequest: function(method, params){ - // summary: - // create a JSON-RPC envelope for the request - // method: string - // The name of the method we are creating the request for - // params: array - // The array of parameters for this request - - var req = { "params": params, "method": method, "id": ++this.lastSubmissionId }; - return json.toJson(req); - }, - - parseResults: function(/*anything*/obj){ - // summary: - // parse the result envelope and pass the results back to - // the callback function - // obj: Object - // Object containing envelope of data we receive from the server - - if(lang.isObject(obj)){ - if("result" in obj){ - return obj.result; - } - if("Result" in obj){ - return obj.Result; - } - if("ResultSet" in obj){ - return obj.ResultSet; - } - } - return obj; - } - }); - -}); diff --git a/lib/dojo/rpc/JsonpService.js.uncompressed.js b/lib/dojo/rpc/JsonpService.js.uncompressed.js deleted file mode 100644 index 673a68c37..000000000 --- a/lib/dojo/rpc/JsonpService.js.uncompressed.js +++ /dev/null @@ -1,66 +0,0 @@ -define("dojo/rpc/JsonpService", [ - "../_base/array", "../_base/declare", "../_base/lang", "./RpcService", "../io/script"], - function(array, declare, lang, RpcService, script){ - -// module: -// dojo/rpc/JsonpService - -return declare("dojo.rpc.JsonpService", RpcService, { - // summary: - // Generic JSONP service. Minimally extends RpcService to allow - // easy definition of nearly any JSONP style service. Example - // SMD files exist in dojox.data - - constructor: function(args, requiredArgs){ - if(this.required){ - if(requiredArgs){ - lang.mixin(this.required, requiredArgs); - } - - array.forEach(this.required, function(req){ - if(req=="" || req==undefined){ - throw new Error("Required Service Argument not found: "+req); - } - }); - } - }, - - strictArgChecks: false, - - bind: function(method, parameters, deferredRequestHandler, url){ - // summary: - // JSONP bind method. Takes remote method, parameters, - // deferred, and a url, calls createRequest to make a JSON-RPC - // envelope and passes that off with bind. - // method: string - // The name of the method we are calling - // parameters: array - // The parameters we are passing off to the method - // deferredRequestHandler: deferred - // The Deferred object for this particular request - - var def = script.get({ - url: url||this.serviceUrl, - callbackParamName: this.callbackParamName||"callback", - content: this.createRequest(parameters), - timeout: this.timeout, - handleAs: "json", - preventCache: true - }); - def.addCallbacks(this.resultCallback(deferredRequestHandler), this.errorCallback(deferredRequestHandler)); - }, - - createRequest: function(parameters){ - // summary: - // create a JSONP req - // params: array - // The array of parameters for this request; - - var params = (lang.isArrayLike(parameters) && parameters.length==1) ? - parameters[0] : {}; - lang.mixin(params,this.required); - return params; - } -}); - -}); diff --git a/lib/dojo/rpc/RpcService.js.uncompressed.js b/lib/dojo/rpc/RpcService.js.uncompressed.js deleted file mode 100644 index 96469af5f..000000000 --- a/lib/dojo/rpc/RpcService.js.uncompressed.js +++ /dev/null @@ -1,178 +0,0 @@ -define("dojo/rpc/RpcService", [ - "../_base/array", "../_base/declare", "../_base/Deferred", "../_base/kernel","../_base/lang", - "../_base/url", "../_base/xhr" -], function(array, declare, Deferred, kernel, lang, _Url, xhr){ - -// module: -// dojo/rpc/RpcService - -return declare("dojo.rpc.RpcService", null, { - // summary: - // TODOC - - constructor: function(args){ - // summary: - // Take a string as a url to retrieve an smd or an object that is an smd or partial smd to use - // as a definition for the service - // - // args: object - // Takes a number of properties as kwArgs for defining the service. It also - // accepts a string. When passed a string, it is treated as a url from - // which it should synchronously retrieve an smd file. Otherwise it is a kwArgs - // object. It accepts serviceUrl, to manually define a url for the rpc service - // allowing the rpc system to be used without an smd definition. strictArgChecks - // forces the system to verify that the # of arguments provided in a call - // matches those defined in the smd. smdString allows a developer to pass - // a jsonString directly, which will be converted into an object or alternatively - // smdObject is accepts an smdObject directly. - // - if(args){ - //if the arg is a string, we assume it is a url to retrieve an smd definition from - if( (lang.isString(args)) || (args instanceof _Url)){ - if (args instanceof _Url){ - var url = args + ""; - }else{ - url = args; - } - var def = xhr.get({ - url: url, - handleAs: "json-comment-optional", - sync: true - }); - - def.addCallback(this, "processSmd"); - def.addErrback(function(){ - throw new Error("Unable to load SMD from " + args); - }); - - }else if(args.smdStr){ - this.processSmd(kernel.eval("("+args.smdStr+")")); - }else{ - // otherwise we assume it's an arguments object with the following - // (optional) properties: - // - serviceUrl - // - strictArgChecks - // - smdStr - // - smdObj - - if(args.serviceUrl){ - this.serviceUrl = args.serviceUrl; - } - - this.timeout = args.timeout || 3000; - - if("strictArgChecks" in args){ - this.strictArgChecks = args.strictArgChecks; - } - - this.processSmd(args); - } - } - }, - - strictArgChecks: true, - serviceUrl: "", - - parseResults: function(obj){ - // summary: - // parse the results coming back from an rpc request. this - // base implementation, just returns the full object - // subclasses should parse and only return the actual results - // obj: Object - // Object that is the return results from an rpc request - return obj; - }, - - errorCallback: function(/* dojo/_base/Deferred */ deferredRequestHandler){ - // summary: - // create callback that calls the Deferred errback method - // deferredRequestHandler: Deferred - // The deferred object handling a request. - return function(data){ - deferredRequestHandler.errback(data.message); - }; - }, - - resultCallback: function(/* dojo/_base/Deferred */ deferredRequestHandler){ - // summary: - // create callback that calls the Deferred's callback method - // deferredRequestHandler: Deferred - // The deferred object handling a request. - - return lang.hitch(this, - function(obj){ - if(obj.error!=null){ - var err; - if(typeof obj.error == 'object'){ - err = new Error(obj.error.message); - err.code = obj.error.code; - err.error = obj.error.error; - }else{ - err = new Error(obj.error); - } - err.id = obj.id; - err.errorObject = obj; - deferredRequestHandler.errback(err); - }else{ - deferredRequestHandler.callback(this.parseResults(obj)); - } - } - ); - }, - - generateMethod: function(/*string*/ method, /*array*/ parameters, /*string*/ url){ - // summary: - // generate the local bind methods for the remote object - // method: string - // The name of the method we are generating - // parameters: array - // the array of parameters for this call. - // url: string - // the service url for this call - - return lang.hitch(this, function(){ - var deferredRequestHandler = new Deferred(); - - // if params weren't specified, then we can assume it's varargs - if( (this.strictArgChecks) && - (parameters != null) && - (arguments.length != parameters.length) - ){ - // put error stuff here, no enough params - throw new Error("Invalid number of parameters for remote method."); - }else{ - this.bind(method, lang._toArray(arguments), deferredRequestHandler, url); - } - - return deferredRequestHandler; - }); - }, - - processSmd: function(object){ - // summary: - // callback method for receipt of a smd object. Parse the smd - // and generate functions based on the description - // object: - // smd object defining this service. - - if(object.methods){ - array.forEach(object.methods, function(m){ - if(m && m.name){ - this[m.name] = this.generateMethod( m.name, - m.parameters, - m.url||m.serviceUrl||m.serviceURL); - if(!lang.isFunction(this[m.name])){ - throw new Error("RpcService: Failed to create" + m.name + "()"); - /*console.log("RpcService: Failed to create", m.name, "()");*/ - } - } - }, this); - } - - this.serviceUrl = object.serviceUrl||object.serviceURL; - this.required = object.required; - this.smd = object; - } -}); - -}); |