MIDP OTA-provisioning using Apache HTTP-server |
IntroductionDuring the recent years I've spent quite a bit of time on developing a few games and applications for Java2 ME (MIDP) enabled cell-phones. Making them online and available for users to download and enjoy requires some way of getting the software onto the cell-phone of the users choosing - the way this is done is ordinarily transferring the file using irDa, Bluetooth or simply allowing the user to download and install them via the builtin web-browser. The latter is the focus of this article, and it is this way of transferring software that is thought of when over the air (OTA) provisioning is discussed.Customizing the Apache HTTP ServerThe Apache server for the most part doesn't need any configuration to serve standard web-pages, and that also includes WML-pages (used for WAP) in case you're wondering. However when it comes to serving games and applications using jad, jar or sis files you'll have to make some small alterations so that the server can mark the files with the correct MIME-type.You have two alternatives for performing the customization - mostly they're the same, but done on two different files. On a server where you don't have access to any of the files specified in either alternative you can try the configuration options specified in alternative 0, but create and add them to a ".htaccess"-file in the same folder as the software you'll be provisioning. In all other situations just choose the one you like the most and remember to restart the apache-server when you are done - also remember to clear the Internet-cache on your phone in case you've tested the page before making the alterations. Alternative 0:The first and foremost alternative on how to customize the apache http server in this way is adding a few configuration options to the main configuration file ("httpd.conf"), the lines to add are the following:AddType text/vnd.sun.j2me.app-descriptor .jad Alternative 1:The second option is mainly the same, but adding configuration options almost similar to those above to the file "mime.types", but personally I don't like to do that since most people only actually backup the file "httpd.conf" before a complete reinstall or other such operations on the server. The lines that you would need to add to "mime.types" are the following:text/vnd.sun.j2me.app-descriptor .jad Adding files to your siteAll newer cell-phones support most of the regular HTML-formattings including WML (old WAP-files), HTML2 as well as XHTML - personally I favor the latter since it requires a stricter compliance with the defined standards (most phone-based web-browser are simple in nature and not very apt at guessing what you actually meant it to do while not doing it in a non-standardized way).Transferring software directly to a cell-phones usually only requires the actual JAR-archive, but OTA-provisioning requires an additional JAD-file that is simply a plaintext file detailing some information about the software including a complete URL to where the actual JAR-file can be downloaded - all, even the basic ones such as Sun Java Wireless Toolkit, development enviroments should make this file for you when the software is packaged. The JAD-files for one of my projects, "Snake Classic" initially looked like the following: MIDlet-1: Snake_Classic_v2, Snake_Classic_v2.png, SnakeMost of these lines are either self-explanatory or irrelevant to our interest in the file, but the one we should concentrate one the lines specifying MIDlet-Jar-URL - in other words this should specify the complete URL to the actual file. For my own web-page at http://games.homelinux.com the JAR-files is placed at the HTTP server's documentroot, and on this server the statement should say the following: MIDlet-Jar-URL: http://games.homelinux.com/Snake_Classic_v2.jarOn the actual web-page you should link to the JAD-file, and NOT the JAR-file since most cell-phones won't know what to do with it. Happy provisioning! Links: |