Announcement

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

    RestDataSource: Evaluating JSON reply resulted in empty value

    I would like to handle the empty response of the RestDataSource.fetchData command. If the server does not provide any response (json-object in my case) I see in a FireBug an absolutely empty Rresponse tab and a message like this - 17:39:30.320 [ERROR] [...] 17:39:30.321:XRP2:WARN:RestDataSource:isc_PagedRestDataSource_0:Evaluating JSON reply resulted in empty value. JSON text: "" - in a Development Mode console. But niether DSCallback is invoked nor the "transformResponse" is executed. I see that the ISC_DataBinding.js performs logWarn with this message.
    I there any way to catch this WARN in the smartGwt application, handle it and show the message in a browser somehow?













    (SmartGWT 2.4.)

    #2
    the default RestDataSource requires some tags in it, even if there are no results.

    http://www.smartclient.com/smartgwt/...ataSource.html

    i believe the empty result should look like this. then your callbacks will fire.

    Code:
    {    
        response:{}
    }
    otherwise, it looks like you need to write a custom datasource. check the showcase for examples of this calling other rest datasources.

    Comment


      #3
      Thanks for your response. Actually if the server responses nothing because of an unhandled exception on the server side there is no even this - "{}". But I see that the ISC_DataBinding.js handles that situation. I would like to catch this also.

      Comment


        #4
        Hi.

        I have similar problem, and it's obvious that empty response need to have json format.

        But I need to secure situation when server response won't have expected format.
        for example:

        Code:
        ds - some RestDataSource
        ds.fetchData(new Criteria(), new DSCallback() {
        	@Override
        	public void execute(DSResponse response, Object rawData, DSRequest request) {
        		GWT.log("execute");
        	}
        });
        the method "execute" won't fire if response is unexpected causing insecure state of application
        I can't notify application's user: "Hey there's a problem on server or elsewhere... stop using it."

        I tried to surround some parts of my code with try ... catch - without any success.
        Is there any way to prevent such situations ?
        (rise some exception, or firing "execute" method with some error status, etc.)

        Comment

        Working...
        X