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.
I also just wanted to mention in case you missed it that one of the Jetty guys, David Yu, has also been doing some cool work on Android, and has recently ported Jetty’s Bayeux client in java onto the phone as well. In case you didn’t realize it, you can do Bayeux either from javascript using one of the libs from the Dojo Foundation’s Cometd project, or from Java using Jetty. David’s wrapped up the client in a demonstration webapp – the famous chat room example! So, you can design your webapps using the highly convenient Bayeux protocol (which is based on a message passing paradigm, so the apis look pretty familiar) and rest easy in the knowledge that it’s going to be accessible both by browser clients (either desktop or on a mobile device) via javascript, and now also even via Android applications!
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.
Categories: GeneralUncategorized
2 Comments
Dongmin Liu · 23/01/2009 at 17:42
thanks a lot! This is very cool! I installed this on my android phone and access my phone book information from my laptop Internet browser over WLAN.
Dongmin
Jan · 27/01/2009 at 10:07
Hi Dongmin,
Thanks for the kind words! In response to your other email to me, the best way to modify the included webapps would be to contribute some patches to the project and eventually earn committer status! 🙂 You will need maven for doing the builds. The build instructions are with the source checkout. The thing to be aware of with the console webapp is that the classes (Servlets etc) are built into the main apk bundle, because they need access to special android api classes.
cheers
Jan
Comments are closed.