Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DataSource operations, change method to POST

    Hi,

    I would like to change a dataSource method from GET to POST because of the length/size of my data.

    I have searched the manual but only found httpMethod on RPC. I don't know how to change it because i'm not sure of what is the relation between DataSource and RPC.

    So, how can i change a dataSource to use POST method?

    Thanks!

    #2
    You need to define your own operationBindings on the dataSource setting the dataProtocol as desired.

    Comment


      #3
      We subclass DataSource to set the options that are common to all our DataSources. For example in this we always pass a session id and the operation type, and set status and message on responses. We do this because we are using PHP in the middle tier, and have implemented some custom things.

      Code:
      isc.defineClass("JSONDataSource", "DataSource");
      
      isc.JSONDataSource.addProperties({
          dataFormat: "json",
          dataProtocol: "postParams",
      
          showPrompt: false,
      
          transformRequest: function(dsRequest){
              var superClassArguments = this.Super("transformRequest", dsRequest);
      
              var newProperties = {
                  OPERATION_TYPE: dsRequest.operationType
              };
      
              if(isc.applicationWindow.loginData.session_id){
                  newProperties.SESSION_ID = isc.applicationWindow.loginData.session_id;
              }
      
              return isc.addProperties({}, superClassArguments, newProperties);
      
          },
      
          transformResponse: function(dsResponse, dsRequest, data){
              dsResponse.statusCode = data.statusCode;
              dsResponse.statusMessage = data.statusMessage;
      
              
          }
      
      });

      Comment

      Working...
      X