To coincide with the first availability of the Android handsets, we’ve released version 1.1 of i-jetty. This release has a lot of improvements in it and some rather cool new features.
One of the improvements we’ve made is to add the ability to configure Jetty settings. Currently, you can decide whether or not to use the NIO connectors (the default is not to, as testing shows that there are some issues with the dalvik NIO lib), which port to start i-jetty on, and set the password to protect access to the i-jetty console webapp.
We’ve also dispensed with the need to setup the sdcard before installing the i-jetty application bundle. Instead, i-jetty will automatically setup the sdcard with it’s directory structure, and also automatically install the console webapp on first startup.
Speaking of the console webapp, we’ve also managed to squeeze it a bit of development on it so that now you can create, delete and update all your Contacts either from the console or the in-built Android application.
But I think the coolest new feature is the ability to download and install webapps from remote http servers on the fly. All you need to do is enter the url of the remote webapp and the context path at which you’d like it to be deployed. i-jetty will fetch it, unpack it, make a context xml file for it and configure the context path for it. You can manually edit the context xml file later if you want to add other setup. We’ve made the 2 example webapps that previously you had to build yourself and copy onto the sdcard downloadable from http://code.google.com/p/i-jetty/downloads/list. For now, after downloading a new webapp, you need to stop and restart jetty to get it deployed. That’s because we disabled the hot deployer as we felt that continually running a thread to check for new webapps would eat the battery too much.
To implement the download feature, we ported the Jetty Http Asynchronous Client onto Android. The Jetty client gives you a nice and extensible way to conduct http conversations with servers. As it’s name suggests, it operates asynchronously, so you get called back when your http response is ready, or you can get intermediate callbacks as various parts of the response come in, such as the headers, or the content bytes etc. It supports proxies, authentication and ssl, although we’ve yet to instrument those for Android.
Finally, if you’re looking for info on how to go about Android-izing a webapp, check out the src of i-jetty, or download the src bundle. We’ve build the webapps using Maven and called out to the Android tools at right places in the build cycle to ensure the servlet classes get built for the dalvik compiler into the appropriate zip file and stored in WEB-INF/lib. Eventually it would be nice to tidy this into a plugin.