[Json-rpc-java] Known bug ? Hanging IE issue
Michael Clark
michael at metaparadigm.com
Fri Apr 20 19:24:50 SGT 2007
Jean-Philippe Encausse wrote:
> Thanks,
> Will you set this patch in the next JSON release ?
Yes. I've commited it to svn-trunk.
> On 4/20/07, Michael Clark <michael at metaparadigm.com> wrote:
>> You could try the following patch.
>>
>> It adds a function as the first argument to the JSONRpcClient
>> constructor
>> and it will the call that function after the system.listmethods has
>> completed.
>>
>> Michael.
>>
>> --- webapps/jsonrpc/jsonrpc.js 2006-03-08 23:09:24.000000000 +0800
>> +++ webapps/jsonrpc/jsonrpc.js 2006-08-28 17:20:20.000000000 +0800
>> @@ -99,12 +97,17 @@
>> /* JSONRpcClient constructor */
>>
>> JSONRpcClient =
>> -function JSONRpcClient_ctor(serverURL, user, pass, objectID)
>> +function JSONRpcClient_ctor()
>> {
>> - this.serverURL = serverURL;
>> - this.user = user;
>> - this.pass = pass;
>> - this.objectID = objectID;
>> + var arg_shift = 0;
>> + if(typeof arguments[0] == "function") {
>> + this.readyCB = arguments[0];
>> + arg_shift++;
>> + }
>> + this.serverURL = arguments[arg_shift + 0];
>> + this.user = arguments[arg_shift + 1];
>> + this.pass = arguments[arg_shift + 2];
>> + this.objectID = arguments[arg_shift + 3];
>>
>> /* Add standard methods */
>> if(this.objectID) {
>> @@ -114,8 +117,17 @@
>> this._addMethods(["system.listMethods"]);
>> var req = this._makeRequest("system.listMethods", []);
>> }
>> + if(this.readyCB) {
>> + var self = this;
>> + req.cb = function JSONRpcClient_async_create(result, e) {
>> + if(!e) self._addMethods(result);
>> + self.readyCB(result, e);
>> + };
>> + }
>> +
>> var m = this._sendRequest(req);
>> - this._addMethods(m);
>> + if(!this.readyCB)
>> + this._addMethods(m);
>> };
>>
>>
>> @@ -335,11 +347,7 @@
>> JSONRpcClient.num_req_active++;
>>
>> /* Send the request */
>> - if (typeof(this.user) == "undefined") {
>> - http.open("POST", this.serverURL, (req.cb != null));
>> - } else {
>> - http.open("POST", this.serverURL, (req.cb != null), this.user,
>> this.pass);
>> - }
>> + http.open("POST", this.serverURL, (req.cb != null), this.user,
>> this.pass);
>>
>> /* setRequestHeader is missing in Opera 8 Beta */
>> try { http.setRequestHeader("Content-type", "text/plain"); }
>> catch(e) {}
>>
>>
>>
>>
>
>
More information about the Json-rpc-java
mailing list