Changeset 1170

Show
Ignore:
Timestamp:
12/20/07 14:47:34 (1 year ago)
Author:
richi
Message:

enhancement #115: fixed js bug fix ;)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/javascript/stub-json-rpc-debug.js

    r1165 r1170  
    2323stubbles.json.rpc.Client = function(clientObj) { 
    2424    var reqRespMapping = []; 
     25    var finalServiceUrl = null; 
    2526 
    2627    var callback = { 
     
    4041                } 
    4142                console.error("Stubbles::REQID " + rpcObj.id +  " :: Invalid request id."); 
    42                 throw 'no related request id for response id found - mapping in js obj reqRespMapping failed!'; 
     43                throw 'stubbles: no related request id for response id found - mapping in js obj reqRespMapping failed!'; 
    4344            } else { 
    4445                console.error("Stubbles::REQID " + rpcObj.id +  " :: ERROR: " + rpcObj.error); 
     
    4849        failure: function(o) { 
    4950            console.error("Stubbles::REQID n/a :: ERROR: HTTP Request failed."); 
    50             throw 'callback error due to bad request from service (instead of HTTP status code 200)'; 
     51            throw 'stubbles: callback error due to bad request from service (instead of HTTP status code 200)'; 
    5152        } 
    5253    }; 
     
    6263 
    6364        if(stubbles.json.rpc.serviceUrl === null) { 
    64             throw 'no service url set via js object \'stubbles.json.rpc.serviceUrl\''; 
     65            throw 'stubbles: no service url set via js object \'stubbles.json.rpc.serviceUrl\''; 
    6566        } else { 
    66             stubbles.json.rpc.serviceUrl = (stubbles.json.rpc.appendToUrl !== null) 
    67                                            ? stubbles.json.rpc.serviceUrl + '&' + stubbles.json.rpc.appendToUrl 
    68                                            : stubbles.json.rpc.serviceUrl + ''; 
     67            if (finalServiceUrl === null) { 
     68                finalServiceUrl =  (stubbles.json.rpc.appendToUrl !== null) 
     69                                  ? stubbles.json.rpc.serviceUrl + '&' + stubbles.json.rpc.appendToUrl 
     70                                  : stubbles.json.rpc.serviceUrl; 
     71            } 
    6972        } 
    7073 
     
    8184        }; 
    8285 
    83         YAHOO.util.Connect.asyncRequest('POST', stubbles.json.rpc.serviceUrl, callback, jsonRpcReq.toJSONString()); 
     86        YAHOO.util.Connect.asyncRequest('POST', finalServiceUrl, callback, jsonRpcReq.toJSONString()); 
    8487        console.info("Stubbles::REQID " + id +  " :: Calling method " + classAndMethod); 
    8588        reqRespMapping.push(jsonRpcReq); 
  • trunk/src/main/javascript/stub-json-rpc.js

    r1167 r1170  
    2222 */ 
    2323stubbles.json.rpc.Client = function(clientObj) { 
    24     var reqRespMapping = []; 
     24    var reqRespMapping  = []; 
     25    var finalServiceUrl = null; 
    2526 
    2627    var callback = { 
     
    3839                    } 
    3940                } 
    40                 throw 'no related request id for response id found - mapping in js obj reqRespMapping failed!'; 
     41                throw 'stubbles: no related request id for response id found - mapping in js obj reqRespMapping failed!'; 
    4142            } else { 
    4243                throw rpcObj.error; 
     
    4445        }, 
    4546        failure: function(o) { 
    46             throw 'callback error due to bad request from service (instead of HTTP status code 200)'; 
     47            throw 'stubbles: callback error due to bad request from service (instead of HTTP status code 200)'; 
    4748        } 
    4849    }; 
     
    5859 
    5960        if(stubbles.json.rpc.serviceUrl === null) { 
    60             throw 'no service url set via js object \'stubbles.json.rpc.serviceUrl\''; 
     61            throw 'stubbles: no service url set via js object \'stubbles.json.rpc.serviceUrl\''; 
    6162        } else { 
    62             if (stubbles.json.rpc.appendToUrl !== null && 
    63                 stubbles.json.rpc.serviceUrl.indexOf('SID') === -1) { 
    64                 stubbles.json.rpc.serviceUrl += '&' + stubbles.json.rpc.appendToUrl; 
     63            if (finalServiceUrl === null) { 
     64                finalServiceUrl =  (stubbles.json.rpc.appendToUrl !== null) 
     65                                  ? stubbles.json.rpc.serviceUrl + '&' + stubbles.json.rpc.appendToUrl 
     66                                  : stubbles.json.rpc.serviceUrl; 
    6567            } 
    6668        } 
     
    7880        }; 
    7981 
    80         YAHOO.util.Connect.asyncRequest('POST', stubbles.json.rpc.serviceUrl, callback, jsonRpcReq.toJSONString()); 
     82        YAHOO.util.Connect.asyncRequest('POST', finalServiceUrl, callback, jsonRpcReq.toJSONString()); 
    8183        reqRespMapping.push(jsonRpcReq); 
    8284        return id;