Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

skin dir problem and datasource problem after upgraded form smartgwtpro 4.1b2013122

$
0
0
we have a very large project by using smartgwtpro 4.1 build 2013-12-22, it works fine before we decided to upgrade to smartgwtpro 4.1 build 2014-07-18,

first problem is :

we have a custom skin dir, and we did set the path in load_skin.js by

Code:

isc.Page.setSkinDir("[ISOMORPHIC]/skins/MySkin/");
isc.Page.loadStyleSheet("[SKIN]/skin_styles.css", theWindow);

suppose our module name is : "main" and our web app can be accessed by :

http://localhost:8080/app

this way works fine before we upgrade it, the js will load skin_styles.css from

http://localhost:8080/app/main/sc/sk...kin_styles.css

after version upgraded, the url changed to

http://localhost:8080/isomorphic/ski...kin_styles.css

the path changed , we notice that the directory name "[ISOMORPHIC]" changed to "http://localhost:8080/isomorphic" somehow,

so some additional settings might required ?


the second problem is :

we use RestDataSource in our project, and we also override its method :

Code:

protected Object transformRequest(DSRequest dsRequest) {
    switch (dsRequest.getOperationType()) {
       
          case UPDATE :
          case ADD: {
                .......
                return JSON.encode(dsRequest.getData());
          }
                break;
          default : {
                ......
              return super.transformRequest(dsRequest);
          }
    }
}

according to api description, we override this method because we need a json object as the request body for our custom rest service in server side and return a json object too. it works fined before upgrade as well as first problem.

however, after upgrade,
browser complains "a error that some object has no selectString method".


we noticed some changes in method " transformResponse : function (dsResponse, dsRequest, data) " in ISC_DataBinding.js

in our working build 2013-12-22 for line 57973
Code:

  if (this.dataFormat == "json") {
        //do json response
        .....
  }else{
      //do xml response
      dsResponse.status = this.getValidStatus(data.selectString("//status"));
      ......
  }


in build 2014-07-18, it changed to

Code:

    if (dsRequest.dataFormat == "json") {
        //do json response
        .....
  }else{
      //do xml response
      dsResponse.status = this.getValidStatus(data.selectString("//status"));
      ......
  }

the code changed judgement statement from "this.dataFormat" to "dsRequest.dataFormat", however the only place we found to set the value of dsRequest.dataFormat is in

line : 64612 in transformRequest function.
Code:

    dsRequest.dataFormat = (this.clientOnly ? "json" : this.dataFormat);
however, if we override method (java)transformRequest in the cases of UPDATE and ADD, the js version method (javascript)transformRequest will never called. so dsRequest.dataFormat aalways null, it will be recognized as a xml response

Unless we still can super.transformRequest(dsRequest) before we return the js object

Code:

  super.transformRequest(dsRequest);
  return JSON.encode(dsRequest.getData());

another solution is we set the value of dataFormat manually

Code:

  dsRequest.setAttribute("dataFormat", "json");
it seems that both solution work for test, but we are sure these are correct way to handle it.


any suggestion for it ? Thanks a lot!

Viewing all articles
Browse latest Browse all 4756

Trending Articles