Dec 19

By default the RestDataSource only supports static url’s. If your backend requires dynamic url’s then you need to subclass RestDataSource and override transformRequest(). In transformRequest() you can set the actionURL property as required by your backend server.

// Following example shows how to append 
// the entities if to the static update url

final RestDataSource restDataSource = new RestDataSource()
   public Object transformRequest(DSRequest dsRequest)
       if (dsRequest.getOperationType().equals(DSOperationType.UPDATE))
          int id = JSOHelper.getAttributeAsInt(
              dsRequest.getData(), "id"));
       return super.transformRequest(dsRequest);

written by objects \\ tags: , , ,