Sllu's Blog

using gwt, gdata, google visualizations and app engine

Posted in Tech by sllu on September 15, 2009

GWT converts java programs into ajax for the client side or rather it’s a tool to produce ajax using the Java language. The interaction with server uses Remote Procedure Call (RPC). GWT can interact with javascript through DOM or through JSNI. Examples to follow. Some relevant tutorials are Using-the-DOM-class-in-AJAX-with-the-GWT 36-gwt-tutorials and links from there. A trivial example and building the killer application demonstrate GWT-RPC mechanism. Three parts tutorial is on Spring, Hibernate and GWT. A very old post about working with Struts/Tiles.  GWT projects can be created on eclipse and deployed to IIS (Stockwatcher folder can be dropped off in UW web folder), Tomcat or google app engine by installing the Google eclipse plugin, which also includes wizards for JSP and servlet projects (the plugin requires JDK not JRE, see this link). To deploy locally, ant hosted or ant hosted –> compile/browse for web mode.

Gdata provide feeds that permit CRUD. Feeds that are of personal interest at this moment are finance and Google Spreadsheets. Writing  programs in Java involving gdata requires adding jar files and dependency jars (included in gdata-java-client src directory) to CLASSPATH. In eclipse, this is achieved by configuring build  path –> add external archives (jars will be added to the referenced libraries). In order to manipulate gdata via web, Apache Tomcat can be used. But remember to include the above mentioned jar files in WEB-INF\lib and modify web.xml file, similarly when using eclipse. [note: dependencies for gdata are google collections; there is a gdata-java-client eclipse plugin]

Data from Google spreadsheets can be visualized through Google Visualization API. The query language and Query.setRefreshInterval(seconds) (for non-spreadsheet-embedded, non-gadget) are quite useful. Google visualization also makes it easy to create a visualization data source through servlets.

Finally, app engine. It uses Jetty (switched from Tomcat, so could change again) as the servlet container. JSP-Servlet projects compile and deploy require external archives to be present in referenced libraries and under war\WEB-INF\lib (for gdata, would be gdata jars and dependencies). Unfortunately, using gdata with app engine is not very smooth, at least when working with Java (word has it that google insiders prefer Python to Java — for Google Documents List Data API, developer’s guide for Python suggests more usage than for Java). Need

<system-properties>

<property name=”com.google.gdata.DisableCookieHandler” value=”true”/>

</system-properties>

to be included in appengine-web.xml to deploy successfully locally. To deploy to app engine though, they have to be removed. Still app engine will cause Server Error, which I suspect comes from authentication to the gdata accounts, as can be seen by what needs to be done with python. Here are some related sites: Google App Engine FAQs (esp. those for Java, one about the above system-properties issue), Java app engine Brazil Demo 2009, authentication, configurations, JDO and googleappengine blog. Search ‘gdata and appengine issue’ without the quotes to see some good links.

A project to link most of these tools: gwt for a survey (or anonymous voting to replace clickers) client-side, recorded onto dedicated spreadsheet through an application on appengine and visualization of the results (refreshed at an interval).

aptana: RadRails ruby on rails development environment

Leave a Reply

You must be logged in to post a comment.