We're trying to integrate client side SmartGWT widgets with data from restful services, and are getting an error in the response. The pertinent code is:
In case it matters, we're running the application in hosted mode in eclipse with Firefox 24.5 as the browser. (SmartGWT version below.)
The errors we're getting are:
in the DSResponse: {response={data=Transport error - HTTP code: 0 for URL: http://dev:18016/config/api/v1/goodstuff, status=-90}}
and on the console: com.smartgwt.client.core.JsObject$SGWT_WARN: 07:56:17.167:XRP2:WARN:RPCManager:xmlHttpRequest.getAllResponseHeaders() returned null
Clearly this is a cross site request. We *think* that should be ok here because we've set RPCManager.setAllowCrossDomainCalls, and we think the browser isn't blocking the call because we see the good URL hit the resful service server. (We'll plan to enable the cross site requests in the tomcat server for production.)
We *think* the response has good headers because when we hit the server with the same URL using Chrome's Advanced Restful Client, we see good-looking header data:
Server: Apache-Coyote/1.1
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Type: application/json
Content-Length: 650
Date: Wed, 08 Apr 2015 00:18:28 GMT
Any pointers to help resolve this would be much appreciated!
Thanks much!
-Bill
SmartClient Version: v9.0p_2013-10-08/LGPL Development Only (built 2013-10-08)
Firefox 24.5 (needs to be older version for security constraints)
Code:
public class SmartGwtProtoRestDetails extends HLayout
{
public SmartGwtProtoRestDetails()
{
DataSource myDS = new DataSource() {
@Override
protected void transformResponse(DSResponse response, DSRequest request, Object data) {
// Parse response here
ListGridRecord[] records = new ListGridRecord[2];
records[0] = createRecord(0,"A","B");
records[1] = createRecord(1,"C","D");
response.setData(records);
response.setStatus(0);
}
};
OperationBinding fetch = new OperationBinding();
fetch.setOperationType( DSOperationType.FETCH);
fetch.setDataProtocol( DSProtocol.GETPARAMS );
myDS.setOperationBindings( fetch );
myDS.setDataFormat(DSDataFormat.CUSTOM);
// Set up DataSourceTextField, etc. here
myDS.setFields( id, a, b, );
myDS.setDataURL( "http://dev:18016/config/api/v1/goodstuff" );
final ListGrid myGrid = new ListGrid();
myGrid.setDataSource(myDS);
// Fill in grid fields, etc, here.
addMember(myGrid);
RPCManager.setAllowCrossDomainCalls( true );
}
public ListGridRecord createRecord(int id, String abbrev, String operator)
{
// ...
}
}The errors we're getting are:
in the DSResponse: {response={data=Transport error - HTTP code: 0 for URL: http://dev:18016/config/api/v1/goodstuff, status=-90}}
and on the console: com.smartgwt.client.core.JsObject$SGWT_WARN: 07:56:17.167:XRP2:WARN:RPCManager:xmlHttpRequest.getAllResponseHeaders() returned null
Clearly this is a cross site request. We *think* that should be ok here because we've set RPCManager.setAllowCrossDomainCalls, and we think the browser isn't blocking the call because we see the good URL hit the resful service server. (We'll plan to enable the cross site requests in the tomcat server for production.)
We *think* the response has good headers because when we hit the server with the same URL using Chrome's Advanced Restful Client, we see good-looking header data:
Server: Apache-Coyote/1.1
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Type: application/json
Content-Length: 650
Date: Wed, 08 Apr 2015 00:18:28 GMT
Any pointers to help resolve this would be much appreciated!
Thanks much!
-Bill
SmartClient Version: v9.0p_2013-10-08/LGPL Development Only (built 2013-10-08)
Firefox 24.5 (needs to be older version for security constraints)