dojo/rpc/JsonService.js

  • Provides:

    • dojo.rpc.JsonService
  • dojo.rpc.JsonService

    • type
      Function
    • chains:
      • dojo.rpc.RpcService: (prototype)
      • dojo.rpc.RpcService: (call)
    • summary
  • dojo.rpc.JsonService.bustCache

    • summary
  • dojo.rpc.JsonService.contentType

    • summary
  • dojo.rpc.JsonService.lastSubmissionId

    • summary
  • dojo.rpc.JsonService.callRemote

    • type
      Function
    • parameters:
      • method: (typeof string)
        the name of the remote method you want to call.
      • params: (typeof array)
        array of parameters to pass to method
    • source: [view]
         var deferred = new dojo.Deferred();
         this.bind(method, params, deferred);
         return deferred;
    • summary
      call an arbitrary remote method without requiring it to be
      predefined with SMD
  • dojo.rpc.JsonService.bind

    • type
      Function
    • parameters:
      • method: (typeof string)
        The name of the method we are calling
      • parameters: (typeof array)
        The parameters we are passing off to the method
      • deferredRequestHandler: (typeof deferred)
        The Deferred object for this particular request
      • url: (typeof )
    • source: [view]
         var def = dojo.rawXhrPost({
          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));
    • 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.
  • dojo.rpc.JsonService.createRequest

    • type
      Function
    • parameters:
      • method: (typeof string)
        The name of the method we are creating the requst for
      • params: (typeof array)
        The array of parameters for this request;
    • source: [view]
         var req = { "params": params, "method": method, "id": ++this.lastSubmissionId };
         var data = dojo.toJson(req);
         return data;
    • summary
      create a JSON-RPC envelope for the request
  • dojo.rpc.JsonService.parseResults

    • type
      Function
    • parameters:
      • obj: (typeof anything)
        Object
        Object containing envelope of data we recieve from the server
    • source: [view]
         if(dojo.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;
    • summary
      parse the result envelope and pass the results back to
      the callback function
  • dojo.rpc

    • type
      Object
    • summary
  • dojo

    • type
      Object
    • summary