jquery

gist JS

Thursday, May 29, 2008

Updating ToCollege.net to 1.5 RC1

With the very exciting release of GWT 1.5 RC1 finally here, I thought I'd drop a quick post in to show you how to upgrade ToCollege.net to RC1. If you're not familiar with it, ToCollege.net is an open source GWT 1.5 example codebase that serves as the sample code for the book Pro Web 2.0 Application Development with GWT. Read more about it here.

Add GWT 1.5 RC1 to your Maven Repository


1) Download GWT 1.5 RC1 for your OS http://code.google.com/webtoolkit/download.html
2) Unzip
3) cp workspace/ProGWT/Setup/maven/gwt/install-* Downloads/gwt-mac-1.5.0.rc1/
4) cd Downloads/gwt-mac-1.5.0.rc1/
5) chmod a+x install*
6) ./install-mac 1.5.0.rc1

This should look something like this:

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [install:install-file] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] [install:install-file]
[INFO] Installing /Users/jdwyah/Downloads/gwt-mac-1.5.0.rc1/gwt-servlet.jar to /Users/jdwyah/.m2/repository/com/google/gwt-servlet/1.5.0.rc1/gwt-servlet-1.5.0.rc1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------


Update ToCollege.net to revision 85:

http://code.google.com/p/tocollege-net/source/detail?r=85
svn up


Revision notes: Update for GWT 1.5.0 RC1:
*Needed to change TabPanel to DecoratedTabPanel and PopupPanel to DecoratedPopupPanel
*Copied in changed to GWT css.
*Moving to the net.tocollege.gwt_maven GWT Maven plugin. Had been using xi8ix-gwtc, but this plugin did unescessary work and didn't seem to be up to date. Run Setup/maven/install-all to install the net.tocollege GWT Maven plugin. (See the pom in revision 85)

Install the new net.tocollege.gwt_maven plugin


cd Setup/maven/
./install-all

Run:


./run_jetty_gwt

Tuesday, May 20, 2008

Big GWT App!

Wondering about using GWT on a big project? Curious whether Google's eating it's own dog food? Well look no further than Google Health.  

A quick 'view source' of the just launched Google Health site will show some code that should be very familiar to GWT developers.

<script language="javascript"
src="../gwt/dashboard/com.google.healthcare.weaver.frontend2.client.WeaverDashboard.nocache.js"></script>
<iframe id="__gwt_historyFrame" src="javascript:''" style="width:0;height:0;border:0;overflow:auto"></iframe>

Get kick-started with your own GWT app with 15,000 lines of GWT source and my book Web 2.0 Application Development with GWT which will show you how integrate GWT with Spring MVC, Hibernate and Spring Security and a host of other Java technologies.


-Jeff


Wednesday, May 14, 2008

GWT and Tickling your Google Analytics Urchin

To see how the new Google Analytics Urchin is integrated with GWT ToCollege.net see the decorator
tocollege.net/src/main/webapp/decorators/default.dec

At the bottom it contains the Analytics page tracker:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-YOUR_TRACKER");
pageTracker._initData();
pageTracker._trackPageview();
</script>


The analytics code is in this one file. ToCollege.net uses
SiteMesh to decorate all of the pages in the site with this decorator, so if you're using SiteMesh this is still the HTML you'll need.

Because GWT will allow you to navigation within a page without reloading the page, you may end up with fewer page views than you'd like and no way to track what users are doing on your site. The way around this is to poke the urchin to let it know that it should record another page view.

See the JSUtils.java file, which has a 'tickleUrchin'
method. This is a JSNI hook so that you can trigger a Google Analytics
page view from within GWT.

For more info on the GWT 1.5.3 code behind ToCollege.net check out the Google Group

Thursday, May 08, 2008

GWT Book Released, Time For Reviews

Well, she's out there. Web 2.0 Application Development with GWT from Apress has finally hit the shelves. I'm can't tell you how happy this makes me.

I've really tried to write the book that I would've wanted to read when I started with GWT, so I hope you like it. For me, GWT itself was fantastic and easy to use, but the biggest stumbling blocks towards getting GWT to work within a complex Java ecosystem. To that end, I've tried to save some trees and leave API specs where they belong (in your IDE's autocomplete).

Continuing with this line of reasoning, instead of giving you a bunch of trivial sample applications, ninety percent of the book is devoted to one big, real world example: a full tour of a real Web 2.0 startup’s codebase. The example is ToCollege.net, a real world startup with an open source codebase. That means that along with the book you get 15,000 lines of source code that includes everything from Google Gears integration to Acegi OpenID, Compass full–text search, and Google Maps, all of it integrated with GWT 1.5.

My idea is that you should be able to leveraging this book’s available source code, to see the nitty–gritty details of how to merge a modern Web 2.0 application stack including Hibernate, Spring, Spring MVC 2.5, SiteMesh, and Freemarker.

Packaging GWT into a WAR file can be a bit of a headache out of the box, so you'll also see how I've wired GWT into an industry standard Maven build environment, which will help you get up to speed quickly and avoid configuration headaches.

One of the The great pitfall of many Ajax applications is they’re mostly opaque to search engines. I spend a lot of time in the book going over ToCollege.net solution to this thorny problem.

Finally, I spend a good bit of time showing how ToCollege.net protects itself from XSS and XSRF attacks. Security is often left as an 'exercise for the reader', but this is a real concern for a site like ToCollege.net. The book will cover the ToCollege.net security architecture in detail.

Thanks for reading and please feel free to get in touch with any questions. There is a Google Group setup here: http://groups.google.com/group/tocollege-net

Cheers!

-Jeff Dwyer
Author of Web 2.0 Application Development with GWT