Apache Wicket on Google App Engine for Java

Holy smokes, that was easy. I’ve got a basic Wicket app running on Google App Engine in under 2 minutes.

3 small traps for the unwary. First of all, you need to enable sessions in your appengine config file.

    true

Secondly, add the following line into your WebApplication’s init() method:

	@Override
	protected void init() {
		super.init();

		//remove thread monitoring from resource watcher
		this.getResourceSettings().setResourcePollFrequency(null);
	}

Thirdly, override the newSessionStore() method to return HttpSessionStore, because the default second level session store uses java.io.File, which Google App Engine doesn’t allow:

	@Override
	protected ISessionStore newSessionStore()
	{
		return new HttpSessionStore(this);
//		return new SecondLevelCacheSessionStore(this, new InMemoryPageStore());
	}

That’s because Google App Engine doesn’t want you spawning threads. Obvious enough.

So that’s it! You’re in a Wicket-land of infinite scalability…

(I’m sure there’s more to it but I was excited…)

See my stupid test here: http://transitplatform.appspot.com/