I’m using smartclient EE version 2.4 and Chrome (also Firefox) with the Eclipse Plugin on Ubuntu 10.10. I added some extra servers (listed in the builtin-ds example) and that solved the HTTP 403 problem (I also took out the setDataURL too). But I now have a different error in that I think means the request is not being formatted correctly. Is there a way to see the request when this happens? Would some other problem cause this error?
=================================
From the console (not the developer one):
Connection received from localhost.localdomain:34109
=== 2011-03-04 09:59:46,283 [90-3] INFO RequestContext - URL: ‘/images/masthead.png’, User-Agent: ‘Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Ubuntu/10.10 Chromium/9.0.597.94 Chrome/9.0.597.94 Safari/534.13’: Safari with Accept-Encoding header
[WARN] No file found for: /images/masthead.png
=== 2011-03-04 09:59:50,055 [90-3] ERROR IDACall - Top-level servlet error:
java.lang.Exception: Non-RPC request ignored.
at com.isomorphic.rpc.RPCManager.parseRequest(RPCManager.java:1605)
at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:286)
at com.isomorphic.rpc.RPCManager.<init>(RPCManager.java:271)
at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:90)
at com.isomorphic.servlet.IDACall.doGet(IDACall.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
/src/smartask/web/client/data/TasklistDS.java
package smartask.web.client.data;
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.events.ErrorEvent;
import com.smartgwt.client.data.events.HandleErrorHandler;
import com.smartgwt.client.data.fields.*;
import com.smartgwt.client.data.OperationBinding;
import com.smartgwt.client.rpc.HandleTransportErrorCallback;
import com.smartgwt.client.rpc.RPCManager;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.DSProtocol;
import smartask.web.client.SmartaskWeb;
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);
this.setPreventHTTPCaching(true);
if(SmartaskWeb.CLIENT)
{
setupClientOnlyMode();
}
else
{
setupServerMode();
}
GWT.log("END DATA SOURCE CREATION");
}
private void setupClientOnlyMode()
{
GWT.log("Doing Client Mode...");
setClientOnly(true);
setDataURL("shared/ds/exampletask.xml");
setRecordXPath("//tasklistDS");
setDataFields();
}
private void setupServerMode()
{
GWT.log("Doing Server Mode...");
setClientOnly(false);
//setDataURL(GWT.getModuleBaseURL()+"tasklistDS/");
setupBindOperations();
setRecordXPath("//tasklistDS");
setDataFields();
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);
}
});
}
private void setDataFields()
{
/*DataSourceTextField idField = new DataSourceTextField("id","Id");
idField.setPrimaryKey(true);
idField.setRequired(true);
idField.setCanEdit(true);
idField.setHidden(true);*/
DataSourceEnumField priorityField = new DataSourceEnumField("priority","Priority");
priorityField.setValueMap(new String[] {"high","medium","low"});
priorityField.setCanEdit(true);
DataSourceTextField nameField = new DataSourceTextField("name", "Name");
nameField.setRequired(true);
nameField.setCanEdit(true);
nameField.setPrimaryKey(true);
DataSourceTextField locationField = new DataSourceTextField("location", "Location");
locationField.setCanEdit(true);
DataSourceDateField dateField = new DataSourceDateField("duedatetime", "Due By");
dateField.setCanEdit(true);
DataSourceTextField tagsField = new DataSourceTextField("tags", "Tags");
tagsField.setCanEdit(true);
DataSourceDateField remField = new DataSourceDateField("remdatetime", "Reminder");
remField.setCanEdit(true);
DataSourceTextField noteField = new DataSourceTextField("notes", "Notes");
noteField.setCanEdit(true);
setFields( priorityField, 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);
OperationBinding add = new OperationBinding();
add.setOperationType(DSOperationType.ADD);
OperationBinding update = new OperationBinding();
update.setOperationType(DSOperationType.UPDATE);
OperationBinding remove = new OperationBinding();
setOperationBindings(fetch, add, update, remove);
}
}
===============
============================================================
/war/shared/ds/tasklistDS.ds.xml
<<DataSource ID=“tasklistDS”>
<fields>
<field primaryKey=“true” name=“id” type=“integer” hidden=“true” required=“true”/>
<field name=“name” type=“text” title=“Name”/>
<field name=“location” type=“text” title=“Location”/>
<field name=“tags” type=“text” title=“Tags”/>
<field name=“duedatetime” type=“date” title=“Due By”/>
<field name=“remdatetime” type=“date” title=“Set Reminder” />
<field name=“notes” type=“text” title=“Notes”/>
</fields>
</DataSource>
============================================================
/war/WEB-INF/web.xml
<web-app xmlns=“http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”
version=“2.4”>
<context-param>
<param-name>HSQLDB_CONFIG</param-name>
<param-value>/WEB-INF/classes/hsqlserver.properties</param-value>
</context-param>
<!--start hsql db on startup for ease of use. Actualy database is located under WEB-INF/db/hsqldb-->
<listener>
<listener-class>com.smartgwt.sample.server.listener.HSQLServletContextListener</listener-class>
</listener>
<!-- Note: The servlets/filters referenced here are documented in the SDK javadoc -->
<!-- //>FileLoader -->
<!-- Dynamic Compression -->
<filter>
<filter-name>CompressionFilter</filter-name>
<filter-class>com.isomorphic.servlet.CompressionFilter</filter-class>
</filter>
<!-- CompressionFilter for dynamic compression -->
<filter-mapping>
<filter-name>CompressionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- //<FileLoader -->
<!-- The IDACall servlet handles all Built-in DataSource operations -->
<servlet>
<servlet-name>IDACall</servlet-name>
<servlet-class>com.isomorphic.servlet.IDACall</servlet-class>
</servlet>
<!-- The DataSourceLoader servlet returns Javascript representations of the dataSources whose
ID's are passed to it - it is an alternative to using the <loadDS> JSP tag -->
<servlet>
<servlet-name>DataSourceLoader</servlet-name>
<servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
</servlet>
<!-- The FileDownload servlet downloads static files, like a webserver -->
<servlet>
<servlet-name>FileDownload</servlet-name>
<servlet-class>com.isomorphic.servlet.FileDownload</servlet-class>
</servlet>
<!-- ISC init: initializes ISC framework -->
<servlet>
<servlet-name>Init</servlet-name>
<servlet-class>com.isomorphic.base.Init</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>HttpProxy</servlet-name>
<servlet-class>com.isomorphic.servlet.HttpProxyServlet</servlet-class>
</servlet>
<!-- The PreCache servlet initializes when the servlet engine starts up and pre-loads
data need for all client requests. This is optional, and improves performance
of the first few page requests. PreCache cannot be invoked by a browser, because
there is no "servlet-mapping" defined for it. -->
<servlet>
<servlet-name>PreCache</servlet-name>
<servlet-class>com.isomorphic.servlet.PreCache</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- RPCManager uses this URL by default for Built-in DataSource operations -->
<servlet-mapping>
<servlet-name>IDACall</servlet-name>
<url-pattern>/SmartaskWeb/sc/IDACall/*</url-pattern>
</servlet-mapping>
<!-- DataSourceLoader requests -->
<servlet-mapping>
<servlet-name>DataSourceLoader</servlet-name>
<url-pattern>/SmartaskWeb/sc/DataSourceLoader</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HttpProxy</servlet-name>
<url-pattern>/SmartaskWeb/sc/HttpProxy/*</url-pattern>
</servlet-mapping>
<!-- Use FileDownload servlet to download all static content that's part of the skin, such as
image files, so we can set Expires headers and other cache control directives. In a
production deployment, you'd want to use a webserver such as Apache to do this.
-->
<servlet-mapping>
<servlet-name>FileDownload</servlet-name>
<url-pattern>/SmartaskWeb/sc/skins/*</url-pattern>
</servlet-mapping>
<!-- serve ISC modules compressed, with expires headers -->
<servlet-mapping>
<servlet-name>FileDownload</servlet-name>
<url-pattern>/SmartaskWeb/sc/system/modules/*</url-pattern>
</servlet-mapping>
<!-- serve ISC development modules compressed, with expires headers -->
<servlet-mapping>
<servlet-name>FileDownload</servlet-name>
<url-pattern>/SmartaskWeb/sc/system/development/*</url-pattern>
</servlet-mapping>
<!-- server skin assets with expires headers -->
<servlet-mapping>
<servlet-name>FileDownload</servlet-name>
<url-pattern>/SmartaskWeb/sc/system/reference/skin/*</url-pattern>
</servlet-mapping>
<!-- General config -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<jsp-config>
<!-- Isomorphic JSP tags -->
<taglib>
<taglib-uri>isomorphic</taglib-uri>
<taglib-location>/WEB-INF/iscTaglib.xml</taglib-location>
</taglib>
</jsp-config>
<mime-mapping>
<extension>manifest</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>SmartaskWeb.html</welcome-file>
</welcome-file-list>
</web-app>
=======================================================
=============================================================================
/src/server.properties
The webRoot directory:
the directory that the servlet engine regards as the place where applications
that use the servlet engine should be installed. Generally, it is safe to leave
this at the default setting of AUTODETECT. When the SmartClient server is
started, it logs a message to stdout telling you the autodetected path to your
webRoot. If this path is not your actual webRoot, then you’ll want to override
this config parameter here.
Valid values:
1. Absolute path to the webRoot directory
2. Special token: AUTODETECT
When this token is used, SmartClient attempts to auto-detect the webRoot using
standard servlet APIs. This may or may not work - depending on your
container type and deployment type. For example, WAR/EAR deployments
on some containers never make it to disk, and so the container refuses
to provide the webRoot path.
If SmartClient cannnot detect the webRoot, it sets the webRoot to
USE_CONTAINER (see below).
3. Special token: USE_CONTAINER
When this token is used, SmartClient uses standard servet APIs for accessing
filesystem resources. This is slower than direct file access and, since
the servlet APIs provide no mechanism for writing to disk, means that some
development tools like the FileAssembler will not work.
webRoot: AUTODETECT
Set this to the GWT module name.
gwtModuleName: SmartaskWeb
if you’ve moved the isomorphic directory from its default location in webRoot,
set the root-relative path to it here
For example, if in your deployment the ‘isomorphic’ dir is in /foo/bar, then set
then you’ll need to set this to foo/bar/isomorphic
isomorphicPathRootRelative: $gwtModuleName/sc
-------------- PICK DATABASE TO USE --------------------
The SmartClient SDK ships with examples that use a database as the persistence
layer. By default, the SDK uses a built-in version of HSQLDB, but you can
specify a different database to use here.
which database do you want to use? HSQLDB is enabled by default.
sql.defaultDatabase: HSQLDB
If you want to use Mysql instead, uncomment the following line
and comment all other sql.defaultDatabase definitions
#sql.defaultDatabase: Mysql
If you want to use Oracle instead, uncomment the following line
and comment all other sql.defaultDatabase definitions
#sql.defaultDatabase: Oracle
If you want to use Postgres instead, uncomment the following line
and comment all other sql.defaultDatabase definitions
#sql.defaultDatabase: PostgreSQL
If you want to use DB2 instead, uncomment the following line
and comment all other sql.defaultDatabase definitions
#sql.defaultDatabase: DB2
-------------- SETTINGS FOR HSQLDB --------------------
sql.HSQLDB.database.type: hsqldb
sql.HSQLDB.interface.type: driverManager
sql.HSQLDB.driver: org.hsqldb.jdbcDriver
sql.HSQLDB.driver.url: jdbc:hsqldb:hsql://localhost/isomorphic
SQLServer
#----------
#sql.SQLServer.database.type: sqlserver
#sql.SQLServer.interface.type: driverManager
#sql.SQLServer.driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
#sql.SQLServer.driver.url: jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=Northwind;User=sa;Password=
DB2
#----
#sql.DB2.database.type: db2
#sql.DB2.interface.type: dataSource
DataSource
#sql.DB2.driver: COM.ibm.db2.jdbc.DB2DataSource
#sql.DB2.driver.serverName: localhost
#sql.DB2.driver.databaseName: SAMPLE
#sql.DB2.driver.portNumber: 6789
#sql.DB2.driver.user: db2admin
#sql.DB2.driver.password: db2admin
-------------- SETTINGS FOR MYSQL --------------------
These are the settings for use with the Mysql database. If you have
just done a fresh install of MySQL on the same machine where you are
running your servlet engine, the values provided below will probably
just work on most platforms.
Configuration for Mysql Connector/J
#sql.Mysql.database.type: mysql
#sql.Mysql.database.ansiMode: false
#sql.Mysql.interface.type: dataSource
#sql.Mysql.driver: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
name of the database to use
#sql.Mysql.driver.databaseName: isomorphic
hostname and port where the database server is installed
#sql.Mysql.driver.serverName: localhost
#sql.Mysql.driver.portNumber: 3306
username and password that can create and modify tables in that database
this user must have the following privileges for the system to function
properly: create/alter/drop table; insert/update/replace/delete rows.
#sql.Mysql.driver.user: root
#sql.Mysql.driver.password:
-------------- SETTINGS FOR ORACLE --------------------
These are the settings for use with the Oracle database.
hostname and port where the database server is installed
#sql.Oracle.driver.serverName: localhost
#sql.Oracle.driver.portNumber: 1521
SID of Oracle Database
#sql.Oracle.driver.databaseName: isomorphic
username and password that can create and modify tables in that database
this user must have the following privileges for the system to function
properly: create/alter/drop table; create/drop sequences;
insert/update/replace/delete rows.
#sql.Oracle.driver.user: system
#sql.Oracle.driver.password: manager
-------------- SETTINGS FOR PostgreSQL --------------------
These are the settings for use with the PostgreSQL database.
hostname and port where the database server is installed
#sql.PostgreSQL.driver.serverName: localhost
#sql.PostgreSQL.driver.portNumber: 5432
name of the database to use
#sql.PostgreSQL.driver.databaseName: isomorphic
username and password that can create and modify tables in that database
this user must have the following privileges for the system to function
properly: create/alter/drop table; create/drop sequences;
insert/update/replace/delete rows.
#sql.PostgreSQL.driver.user: postgres
#sql.PostgreSQL.driver.password: test
-------------- LOADING APP AND DATASOURCE DEFINITIONS --------------------
Where the system looks for DataSource definition files ([dataSourceId].ds.xml or
[dataSourceID].ds.js). It’s useful to put all your DataSources in one
directory since DataSources are frequently shared between applications.
“project.datasources” is also where the DataSource Importer tool looks
for available DataSources.
project.datasources=$webRoot/images
project.ui: $webRoot/shared/ui
project.apps: $webRoot/shared/app
-------------- Other settings --------------------
The setting RPCManager.enabledBuiltinMethods enables or disables the BuiltInRPCs - RPC calls
that are built into the SmartClient Server. The setting below reflects the framework default
of enabling only those RPCs that are typically needed in an application.
See the JavaDoc for com.isomorphic.rpc.BuiltinRPC and com.isomorphic.tools.BuiltinRPC for all
available builtinRPCs and their behavior.
Note that many of the BuiltinRPCs are designed for use by tools such as Visual Builder, and
provide services such as direct access to the file system (for load and save of screens) that
would be unsafe to expose to untrusted users.
#RPCManager.enabledBuiltinMethods: xmlToJS, uploadProgressCheck, exportClientData, downloadClientExport, setAttributes
===================================================
/src/smartask/web/SmartaskWeb.gwt.xml
========================================
<?xml version=“1.0” encoding=“UTF-8”?>
<module rename-to=‘SmartaskWeb’>
<!-- 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.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.smartgwtee.SmartGwtEE”/>
<inherits name=“com.smartgwtee.tools.Tools”/>
<!-- –>
<!-- inherits name=com.smartgwt.Gwt –>
<!-- <inherits name=“com.smartgwt.SmartGwt”/>
<inherits name=“com.smartgwt.SmartGwtNoTheme”/>
–>
<!-- inherits name=‘com.smartclient.theme.silverwave.SilverWave’ />
–>
<!-- Specify the app entry point class. –>
<entry-point class=‘smartask.web.client.SmartaskWeb’/>
<!-- Specify the paths for translatable code –>
<source path=‘client’/>
<source path=‘shared’/>
</module>
==============================