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). Actually I'm not sure what URL to use in setDataURL and the server.properties file or where to put the data source xml file in the directory. Is there a reference in the documents to where to put files, etc. The examples (bundled in smartgwtee.zip and in the showcase) aren't full Eclipse project files so they aren't too helpful on file placement.
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.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:532)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(Meth odAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(Met hodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invok e(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reac tToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection(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 (Is this correct?):
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.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:532)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(Meth odAdaptor.java:105)
at com.google.gwt.dev.shell.MethodDispatch.invoke(Met hodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invok e(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reac tToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.proc essConnection(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 (Is this correct?):
project.datasources=$webRoot/shared/ds
Comment