I'm using smartclient EE version 2.4 and Chrome (also Firefox) with the Eclipse Plugin on Ubuntu 10.10. I have the datasource xml file in 'shared/ds' off of the war directory. While running the local HTTP server (jetty) in Eclipse, I keep getting a 403 HTTP error which says I'm forbidden to access the file. I'm not running any authentication so I can't imagine why I can't access a file running on own machine. So is there other reasons for this error? I do have world read and write permissions on the file and directories. I'm a CS student so I'm not too knowledgeable about web-based programming (I'm still trying to learn it).
From the developer console:
01:16:41.450 [ERROR] [SmartaskWeb] 01:16:41.447:XRP9:WARN:RPCManager:Transport error - HTTP code: 403 for URL: shared/ds, response: {operationId: "tasklistDS_add",
clientContext: Obj,
context: Obj,
transactionNum: 0,
httpResponseCode: 403,
httpResponseText: "<html>\n<head>\n<meta http-equiv="Content-..."[1374],
xmlHttpRequest: [object XMLHttpRequest],
transport: "xmlHttpRequest",
status: -90,
clientOnly: undef,
httpHeaders: Obj,
isStructured: true,
callbackArgs: null,
results: Obj,
data: "Transport error - HTTP code: 403 for URL..."[51],
__gwt_ObjectId: 720,
startRow: 0,
endRow: 0,
totalRows: 0}
com.smartgwt.client.core.JsObject$SGWT_WARN: 01:16:41.447:XRP9:WARN:RPCManager:Transport error - HTTP code: 403 for URL: shared/ds, response: {operationId: "tasklistDS_add",
clientContext: Obj,
context: Obj,
transactionNum: 0,
httpResponseCode: 403,
httpResponseText: "<html>\n<head>\n<meta http-equiv="Content-..."[1374],
xmlHttpRequest: [object XMLHttpRequest],
transport: "xmlHttpRequest",
status: -90,
clientOnly: undef,
httpHeaders: Obj,
isStructured: true,
callbackArgs: null,
results: Obj,
data: "Transport error - HTTP code: 403 for URL..."[51],
__gwt_ObjectId: 720,
startRow: 0,
endRow: 0,
totalRows: 0}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:636)
My datasource class:
public class TasklistDS extends DataSource {
private static TasklistDS instance = null;
public static TasklistDS getInstance() {
if (instance == null) {
instance = new TasklistDS("tasklistDS");
}
return instance;
}
public TasklistDS(String id) {
setID(id);
setupBindOperations();
setDataFields();
setDataURL("shared/ds");
this.addHandleErrorHandler(new HandleErrorHandler(){
@Override
public void onHandleError(ErrorEvent event) {
GWT.log("DataSource: "+event.getResponse());
}
});
RPCManager.setHandleTransportErrorCallback(new HandleTransportErrorCallback(){
@Override
public void handleTransportError(int transactionNum, int status,
int httpResponseCode, String httpResponseText) {
GWT.log("TRANSPORT: " + httpResponseText);
}
});
GWT.log("END DATA SOURCE CREATION");
}
private void setDataFields()
{
DataSourceTextField idField = new DataSourceTextField("id","Id");
idField.setPrimaryKey(true);
idField.setRequired(true);
idField.setCanEdit(false);
idField.setHidden(true);
DataSourceEnumField priorityField = new DataSourceEnumField("priority","Priority");
priorityField.setValueMap(new String[] {"high","medium","low"});
DataSourceTextField nameField = new DataSourceTextField("name", "Name");
nameField.setRequired(true);
DataSourceTextField locationField = new DataSourceTextField("location", "Location");
DataSourceDateField dateField = new DataSourceDateField("duedatetime", "Due By");
DataSourceTextField tagsField = new DataSourceTextField("tags", "Tags");
DataSourceDateField remField = new DataSourceDateField("remdatetime", "Reminder");
DataSourceTextField noteField = new DataSourceTextField("notes", "Notes");
setFields(priorityField, idField, nameField,
dateField, locationField, tagsField, remField, noteField );
}
/* private void setURLPaths()
{
setFetchDataURL("ds/task_fetch_rest.xml");
setAddDataURL("ds/task_add_rest.xml");
setUpdateDataURL("ds/task_update_rest.xml");
setRemoveDataURL("ds/task_remove_rest.xml");
}*/
private void setupBindOperations()
{
OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
OperationBinding add = new OperationBinding();
add.setOperationType(DSOperationType.ADD);
add.setDataProtocol(DSProtocol.POSTMESSAGE);
OperationBinding update = new OperationBinding();
update.setOperationType(DSOperationType.UPDATE);
update.setDataProtocol(DSProtocol.POSTMESSAGE);
OperationBinding remove = new OperationBinding();
remove.setOperationType(DSOperationType.REMOVE);
remove.setDataProtocol(DSProtocol.POSTMESSAGE);
setOperationBindings(fetch, add, update, remove);
}
}
Also my settings in server.properties for the datasource:
project.datasources=$webRoot/shared/ds
From the developer console:
01:16:41.450 [ERROR] [SmartaskWeb] 01:16:41.447:XRP9:WARN:RPCManager:Transport error - HTTP code: 403 for URL: shared/ds, response: {operationId: "tasklistDS_add",
clientContext: Obj,
context: Obj,
transactionNum: 0,
httpResponseCode: 403,
httpResponseText: "<html>\n<head>\n<meta http-equiv="Content-..."[1374],
xmlHttpRequest: [object XMLHttpRequest],
transport: "xmlHttpRequest",
status: -90,
clientOnly: undef,
httpHeaders: Obj,
isStructured: true,
callbackArgs: null,
results: Obj,
data: "Transport error - HTTP code: 403 for URL..."[51],
__gwt_ObjectId: 720,
startRow: 0,
endRow: 0,
totalRows: 0}
com.smartgwt.client.core.JsObject$SGWT_WARN: 01:16:41.447:XRP9:WARN:RPCManager:Transport error - HTTP code: 403 for URL: shared/ds, response: {operationId: "tasklistDS_add",
clientContext: Obj,
context: Obj,
transactionNum: 0,
httpResponseCode: 403,
httpResponseText: "<html>\n<head>\n<meta http-equiv="Content-..."[1374],
xmlHttpRequest: [object XMLHttpRequest],
transport: "xmlHttpRequest",
status: -90,
clientOnly: undef,
httpHeaders: Obj,
isStructured: true,
callbackArgs: null,
results: Obj,
data: "Transport error - HTTP code: 403 for URL..."[51],
__gwt_ObjectId: 720,
startRow: 0,
endRow: 0,
totalRows: 0}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:636)
My datasource class:
public class TasklistDS extends DataSource {
private static TasklistDS instance = null;
public static TasklistDS getInstance() {
if (instance == null) {
instance = new TasklistDS("tasklistDS");
}
return instance;
}
public TasklistDS(String id) {
setID(id);
setupBindOperations();
setDataFields();
setDataURL("shared/ds");
this.addHandleErrorHandler(new HandleErrorHandler(){
@Override
public void onHandleError(ErrorEvent event) {
GWT.log("DataSource: "+event.getResponse());
}
});
RPCManager.setHandleTransportErrorCallback(new HandleTransportErrorCallback(){
@Override
public void handleTransportError(int transactionNum, int status,
int httpResponseCode, String httpResponseText) {
GWT.log("TRANSPORT: " + httpResponseText);
}
});
GWT.log("END DATA SOURCE CREATION");
}
private void setDataFields()
{
DataSourceTextField idField = new DataSourceTextField("id","Id");
idField.setPrimaryKey(true);
idField.setRequired(true);
idField.setCanEdit(false);
idField.setHidden(true);
DataSourceEnumField priorityField = new DataSourceEnumField("priority","Priority");
priorityField.setValueMap(new String[] {"high","medium","low"});
DataSourceTextField nameField = new DataSourceTextField("name", "Name");
nameField.setRequired(true);
DataSourceTextField locationField = new DataSourceTextField("location", "Location");
DataSourceDateField dateField = new DataSourceDateField("duedatetime", "Due By");
DataSourceTextField tagsField = new DataSourceTextField("tags", "Tags");
DataSourceDateField remField = new DataSourceDateField("remdatetime", "Reminder");
DataSourceTextField noteField = new DataSourceTextField("notes", "Notes");
setFields(priorityField, idField, nameField,
dateField, locationField, tagsField, remField, noteField );
}
/* private void setURLPaths()
{
setFetchDataURL("ds/task_fetch_rest.xml");
setAddDataURL("ds/task_add_rest.xml");
setUpdateDataURL("ds/task_update_rest.xml");
setRemoveDataURL("ds/task_remove_rest.xml");
}*/
private void setupBindOperations()
{
OperationBinding fetch = new OperationBinding();
fetch.setOperationType(DSOperationType.FETCH);
fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
OperationBinding add = new OperationBinding();
add.setOperationType(DSOperationType.ADD);
add.setDataProtocol(DSProtocol.POSTMESSAGE);
OperationBinding update = new OperationBinding();
update.setOperationType(DSOperationType.UPDATE);
update.setDataProtocol(DSProtocol.POSTMESSAGE);
OperationBinding remove = new OperationBinding();
remove.setOperationType(DSOperationType.REMOVE);
remove.setDataProtocol(DSProtocol.POSTMESSAGE);
setOperationBindings(fetch, add, update, remove);
}
}
Also my settings in server.properties for the datasource:
project.datasources=$webRoot/shared/ds