Announcement

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

    transformResponse access xml data

    In a RestDataSource (with setDataFormat(DSDataFormat.XML)) I override:

    protected void transformResponse(DSResponse response, DSRequest request, Object data)

    But I can't seem to extract the full xml document of ht response, can u point me in the right direction to extract an ordinary com.google.gwt.xml.client.Document from a response? If I can get the XML is String form, it can obviously be parsed, but I can't seem to get the XML at all.

    I've tried: XMLTools.selectNodes(data, "/");

    thanks!

    Bas

    #2
    Hi Bas,

    If you want to basically use the RestDataSource's request and response formats and just want to extract a few extra items from the response, use the APIs of XMLTools with the "data" object.

    If you want to do your own processing from scratch, start with DataSource instead of RestDataSource, set dataProtocol to custom and the type of "data" will be a String.

    Comment


      #3
      Ah, ok, I will look into that, I need it because sometimes my server side will not return data for the restdatasource to be interpreted, for instance if the server can not handle the request because the session has timed out, or a foreign key violation or some other big thing.
      I want to check if this situation occurred on the clientside and handle it. If I stick this error in the XML send back to the client I need to check somewhere for it and inform the user or handle it someway. Any ideas on how to go about handling big (non operation-related) server side errors?

      For instance showing a modal window "your session has expired, please log in again" (when the restdatasource expects records)

      thanks!

      Bas

      Comment


        #4
        See the SmartClient docs for Relogin for handling something like session timeout.

        Comment


          #5
          will do, thanks!

          Comment


            #6
            I am currently overriding DataSource, requests are send nicely by my code (from the overridden transformRequest) and the result from the server is interpreted fine. Only when I've interpreted the result which method your I call to condition the DataSource with the result?

            I've tried both:

            super.transformResponse(dsResponse, dsRequest, listGridRecords.toArray());


            and
            super.processResponse(dsRequest.getRequestId(), dsResponse);

            If you can shed some lighy on this it will be greatly appreciated,

            The listGrid currently stays empty,

            Bas

            Comment

            Working...
            X