Downloaded latest SmartGWT 4.0 jars and testing simple ListGrid example from
http://www.smartclient.com/smartgwt/showcase/#featured_restfulds
SmartClient Version: v9.0p_2013-11-07/LGPL Development Only (built 2013-11-07)
Browser Used
IE 10
Error Stack Trace from Developer console.
03:11:50.513:TMR6:WARN:RPCManager:<response xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><data>Transport error - HTTP code: 404 for URL: shared/data/countrydata.xml</data><status xsi:type="xsd:long">-90</status></response>undefined - response: {status: -90,
data: "<response xmlns:xsi="http://www.w3.org/2..."[222],
httpResponseCode: 404,
httpResponseText: "<html>\n<head>\n<meta http-equiv="Content-..."[1413],
transactionNum: 0,
clientContext: Obj,
httpHeaders: Obj,
context: Obj,
queueStatus: -1,
startRow: 0,
endRow: 0,
totalRows: 0}
Sample Code :
web.xml
.gwt.xml
Although i have searched quite a lot to fix this error by taking support from different threads on this topic i had no luck.
Appreciate your guidance.
http://www.smartclient.com/smartgwt/showcase/#featured_restfulds
SmartClient Version: v9.0p_2013-11-07/LGPL Development Only (built 2013-11-07)
Browser Used
IE 10
Error Stack Trace from Developer console.
03:11:50.513:TMR6:WARN:RPCManager:<response xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:type="xsd:Object"><data>Transport error - HTTP code: 404 for URL: shared/data/countrydata.xml</data><status xsi:type="xsd:long">-90</status></response>undefined - response: {status: -90,
data: "<response xmlns:xsi="http://www.w3.org/2..."[222],
httpResponseCode: 404,
httpResponseText: "<html>\n<head>\n<meta http-equiv="Content-..."[1413],
transactionNum: 0,
clientContext: Obj,
httpHeaders: Obj,
context: Obj,
queueStatus: -1,
startRow: 0,
endRow: 0,
totalRows: 0}
Sample Code :
Code:
VLayout layout = new VLayout(15);
layout.setAutoHeight();
//overrides here are for illustration purposes only
RestDataSource countryDS = new RestDataSource() {
@Override
protected Object transformRequest(DSRequest dsRequest) {
return super.transformRequest(dsRequest);
}
@Override
protected void transformResponse(DSResponse response, DSRequest request, Object data) {
super.transformResponse(response, request, data);
}
};
DataSourceTextField countryCode = new DataSourceTextField("countryCode", "Code");
// These lines are not required for this sample to work, but they demonstrate how you can configure RestDataSource
// with OperationBindings in order to control settings such as whether to use the GET, POST or PUT HTTP methods,
// and whether to send data as URL parameters vs as posted JSON or XML messages.
OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.GETPARAMS);
countryDS.setOperationBindings(fetch);
countryDS.setDataFormat(DSDataFormat.XML);
countryCode.setPrimaryKey(true);
countryCode.setCanEdit(false);
DataSourceTextField countryName = new DataSourceTextField("countryName", "Country");
DataSourceTextField capital = new DataSourceTextField("capital", "Capital");
countryDS.setFields(countryCode, countryName, capital);
countryDS.setFetchDataURL("shared/data/countrydata.xml"); //created an xml file with the results as mentioned in the sample country_fetch_rest.xml
final ListGrid countryGrid = new ListGrid();
countryGrid.setWidth(500);
countryGrid.setHeight(224);
countryGrid.setDataSource(countryDS);
countryGrid.setEmptyCellValue("--");
ListGridField codeField = new ListGridField("countryCode");
ListGridField nameField = new ListGridField("countryName");
ListGridField capitalField = new ListGridField("capital");
ListGridField continentField = new ListGridField("continent", "Continent");
countryGrid.setFields(codeField, nameField, capitalField, continentField);
countryGrid.setSortField(0);
countryGrid.setDataPageSize(50);
countryGrid.setAutoFetchData(true);
layout.addMember(countryGrid);
TabSet tabSet = new TabSet();
tabSet.setHeight(400);
tabSet.setWidth(500);
Tab fetchTab = new Tab("country_fetch.xml");
final HTMLPane fetchPane = new HTMLPane();
fetchPane.setContentsURL("shared/data/content.html");
fetchPane.setContentsType(ContentsType.PAGE);
fetchTab.setPane(fetchPane);
tabSet.setTabs(fetchTab);
layout.addMember(tabSet);
layout.draw();
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>SGDemo.html</welcome-file>
</welcome-file-list>
</web-app>
Code:
<?xml version="1.0" encoding="UTF-8"?> <!-- When updating your version of GWT, you should also update this DTD reference, so that your app can take advantage of the latest GWT module capabilities. --> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd"> <module rename-to='sgdemo'> <!-- Inherit the core Web Toolkit stuff. --> <inherits name='com.google.gwt.user.User'/> <!-- Inherit the default GWT style sheet. You can change --> <!-- the theme of your GWT application by uncommenting --> <!-- any one of the following lines. --> <!-- <inherits name='com.google.gwt.user.theme.clean.Clean'/> --> <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> --> <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> --> <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> --> <!-- Other module inherits --> <inherits name="com.smartgwt.SmartGwt"/> <inherits name="com.smartgwt.tools.SmartGwtTools"/> <!-- Specify the app entry point class. --> <entry-point class='com.bharath.sgdemo.client.SGDemo'/> <!-- Specify the paths for translatable code --> <source path='client'/> <source path='shared'/> </module>
Appreciate your guidance.