Archive for June, 2009

Grails and Google AppEngine

Monday, June 8th, 2009

I’ve created a small demo showing Grails on Google AppEngine.

The site is a showcase of Grails on Google AppEngine with the Grails AppEngine plugin.

Places are stored in the AppEngine datastore and a taglib is added for rendering the login button and the currently logged in user.

Additionally, an integration with Google AJAX Search API is done when adding a place.

URL.equals()

Monday, June 8th, 2009

Apparently in Java an URL is equal if the ip is the same, so the following test will succeed (kapaza.be and kapaza.nl have the same ip address).

public void testURLEquals() throws MalformedURLException {
  assertEquals(new URL("http://www.kapaza.be"), new URL("http://www.kapaza.nl"));
}

Just so you know when you get strange results when putting URLs in a Set…  It’s even worse, since this means that comparing URLs needs name resolution, which is a slowdown.  More in the Javadocs.

One solution is to use an URI instead of an URL.  This will fail:

public void testURIEquals() throws URISyntaxException {
  assertEquals(new URI("http://www.kapaza.be"), new URI("http://www.kapaza.nl"));
}