In one of my previous posts I started my adventures with GWT technology.
The best way of learning new technology is implementation of some real idea that you have in your head.
Many of you should know the Artemiy Lebedev’s design studio site. Sometimes when I have a spare minute I like to visit their Business Lynch block. Their idea is very funny: people sends examples of their own design pieces and ask professionals from Lebedev art studio to evaluate and comment them. Most often they comment the work in a “It sucks” fashion.
I always wished there was a possibility for site visitors to leave comments there as well, that would be funny. But authors of the site did not provide such possibility.
So my idea was to create a small site that will cut from the ArtLebedev portal only Business Lynch block and allow visitors posting their comments. And I wanted this to be done on GAE and with help of GWT.
I did it quite fast, in few days of work. The result is here: art-lebedev-mirror.
Now I will briefly describe how it is done and what I used and learned for doing it.
The first thing was to get the raw HTML content of the original site and extracting the Business Lynch block out of there. So I needed a parser. My brain already tried earlier the convenient way of working with XML in Flex so I was about to work with DOM instead of some SAX parsers.
Most of SAX parsers expect y0u feed them with well formed XML documents. As you might already suggest the HTML source code of the ArtLebedev site was not strict and well-formed enough. So good well-known SAX parsers just thrown me some errors and refused to dig further.
Then I found in the internet the TagSoup parser which was designed specifically to be able to parse even very crappy documents. Also I found out the Apache Xalan processor. I feed the SAX-source produced by TagSoup to Xalan and it gave me a nice DOM representation of the HTML source code. So I was able to cut out the pieces I need.
The next thing was to add commenting facility. I decided to use GAE JDO for persistence and GWT for the overall UI.
There was one surprise with JDO here. As far as comment can be replied to other comments I decided to model the data entities recursively, i.e. allowing Comment entity to contain list of other Comment entities. I wasted the whole day on this trying to understand why the simple thing is not working and finally good people shown me this known DataNucleus issue. So I needed to redevelop the relationship as unowned
In the process I learned also a log of different small things in GWT that you will not feel until you start building real things.
[...] Simple Form Navigation 22 02 2010 I already mentioned the simple site I am developing while learning GWT. There is a simple comment submission form with [...]