Archive for Web 2.0

Wicket first contact

While working on an AJAX web application a couple of weeks ago, a co-worker asked me what I know about Wicket. Not much at that time. I knew it was some kind of component based web framework, but only in the sense like everybody knows that Porsche is a German car brand.

During the recent holidays I spent the entire time away from work and with my family. As most of the time when I’m away from work I made a list of things to look at. Wicket was not on that list. I seldom make it at least half way thru that list anyway. It was the same this time. But then I saw this article on TheServerSide about the release of Wicket 1.3. The big amount of comments caught my interest. Suddenly, Wicket was on that list.

Today, I downloaded and installed Wicket, and then looked for documentation and tutorials. Besides some interesting online resources, I found the combination of two books on Wicket the most helpful:

The first book seems a little more verbose than the second book and covers more background, while the second book (besides being more complete right now) has much more source code examples. They complement each other perfectly in my opinion. So I got them both.

After reading thru the first three freely available chapters of “Enjoying Web Development with Wicket”, I got interested in chapter 6 (Supporting Other Languages). I was really impressed to see how I18N is a first class citizen in Wicket.

Screenshot from the Cheesr sample application

I then turned to “Wicket in Action”. Right now it is not completed and contains many errors, but none of this is really a problem. I made it thru the chapters 1-4 and implemented the Cheesr sample application (from chapter 4) along the way.

I really like what I’ve seen so far from Wicket:

  • It’s component based and encapsulates the request/response cycle
  • Components seem easy to write
  • Good internationalisation concept
  • Separation from logic and presentation

Right, I’ve barely scratched the surface yet, but Wicket as a web framework looks promising.

Comments

Why I upgraded to GWT 1.4.61

The previous version GWT 1.4.60 came out on August 27th, 2007. A couple of days later I had upgraded all my applications, the expression calculator demo too. None of the applications suffered from a strange bug except the demo. It appeared only when Microsoft’s Internet Explorer was used. A message box was displayed that told the user: “operation aborted”. The page wasn’t shown at all, the user only saw a blank page. I had to remove the demo, at least from the home page. Since only the demo was affected, I didn’t go back to GWT 1.4.59.

Three days after GWT 1.4.60 came out, the issue was reported, approximately at the same time I was experiencing it. I was hoping for a quick fix, but it didn’t come.

Several month later, Google’s Scott Blum wrote in the GWT forum about an updated GWT 1.4 release. Although I read the forum quite regularly, I nearly missed his posting. He talks about the new release fixing the problem, and he also provides a download link for GWT 1.4.61. I’ve downloaded it and upgraded all my application without a problem so far.

Google Web Toolkit 1.4.61 is available for download

Since it fixes a very serious problem, you should upgrade also. Problem is, you will not see the new version on the GWT download page. At least not yet, but I bet you will see it there shortly. In the meantime, just use this link.

Update: It took a little bit longer than I expected, but the GWT Team has just officially released GWT 1.4.61, which takes care of some minor bugs in the previous release of GWT 1.4.60. The two main issues that were addressed are the “operation aborted” startup error on IE and a potential XSS vulnerability in hosted mode.

There are no differences between the 1.4.61 version released on December 12th, 2007 and the 1.4.61 version released on November 3rd, 2007.

Comments

A small GWT application

I had some time today, so I built a little AJAX application for this blog. It’s an expression calculator. The world really doesn’t need another one, but it was the easiest thing that includes ANTLR for building a lexer/parser/AST and the Google Web Toolkit for building the client. Why? Because it’s fun …

If the application doesn’t load, please click here!

Before I was able to include a GWT application within a post in this WordPress powered blog, I had to create a WordPress plugin that generates the necessary meta tags. GWT applications only work, when those meta tags are present.

The actual calculation of the expression is done on the server with the help of my Java based framework. The expression is sent to the server asynchronously as a JSON data packet. The server logic evaluates the expression and sends back either the result, or an error message. If you want to see an error message, try a division by 0. The response is sent also in the JSON format back to the browser, where the GWT application takes it and displays it without refreshing the whole page.

The server side logic is built with the help of ANTLR and ANTLR Studio for Eclipse. Instead of writing a lexer and parser for evaluation of the expressions myself, I’ve used a grammar to let these tools do it for me. The following screenshot shows ANTLR Studio for Eclipse in action:

Eclipse screenshot with ANTLR Studio

If you want to know what ANTLR is, here is a quote from Terence Parr, the primary author of ANTLR. He has been working on translation tools since the late 80s:

ANTLR, ANother Tool for Language Recognition, (formerly PCCTS) is a parser and translator generator tool, akin to the venerable lex/yacc duo, that lets you construct recognizers, compilers, and source-to-source translators from grammatical descriptions containing C++ or Java actions. You can build translators for database formats, graphical data files (e.g., PostScript, AutoCAD), text processing files (e.g., HTML, SGML), etc. ANTLR is designed to handle all of your translation tasks. ANTLR is recommended by the co-inventor of LL(k) parsers and by the inventor of SLR(k) and LALR(k) parser.

Another tool makes generation of GWT clients easier. It’s the GWT Designer from Instantiations. I’m having a few problems with it, but it still helps a lot. See the following screenshot for an impression:

Eclipse screenshot with GWT Designer

If you’re interested in this example built with GWT, ANTLR, JSON, etc., and you want to look at the source code, just download it from here.

Do you remember the little problem from the Geometry for kids post earlier today? With the calculator, you can verify if the solution is correct: d = sqrt(3)*5.3.

Update: As of GWT 1.4, a new application-loading mechanism has been introduced, that doesn’t require a meta tag in the page header. It’s still supported for legacy applications. But now, the applications HTML code can directly reference the JavaScript file. I’ve changed the example above accordingly.

Comments (1)

JavaWorld: Dynamic Webpages with JSON

There’s an interesting article on how to overcome the same origin policy used by modern web browsers. It’s a security policy that prevents JavaScript from accessing a location different from the one it was loaded from. Same location normally means same protocol, subdomain, and domain. The same origin policy is sometimes called same site policy. One of the reasons for having this policy is to fix security issues like cross site scripting.

Communication between the synformation server and the client web application takes place under the same origin policy. Whenever the client needs data from another service outside the synformation domain, the synformation server can act as a proxy for such requests, thus avoiding to circumvent the policy. If you don’t have a server to act as a proxy for you, then the technique described in this article might be of interest to you. From a security perspective, neither of the two approaches is inherently more safe.

Comments