Apache in a Wireless World Page 2

Remember that the driving force behind WML is that a wireless device has a small, often tiny, screen and cannot display very much information -- sometimes as little as four or five lines of text. Thus, there's no real space for graphics other than the occasional small logo, most text is the same size, and the screen is often monochrome. So, the real strength in wireless networking is not the capability to replicate land-based Web surfing on the street or in the air, but to target small, focused pieces of data, such as a weather report, a sports score, or a travel reservation.

Like HTML, a WML document is a text document when created as source code. Although this is not a WML tutorial, per se, let's look at a simple WML deck of cards, to get a feel for the type of data that Apache will deliver to wireless devices. We'll set up a WML deck with two cards: the first with a greeting and a link to the second card, the second with some very fictitious "favorite WML pages".

<?xml version="1.0"?>

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
   <do type="back" label="Back">
  <card id="main" title="Welcome to my WAP">
   <p align="center">I can't say much, since this screen is tiny.<br/>
   Why don't you visit my <a href="#fave">favorite WAP links.</a></p>
  <card id="fave" title="Favorite WAP Links">
   <p align="center">These are some WAP sites I would love, if they existed.</p>
   <p align="left">

<a href="wap.cats.com">Tiny cat pictures</a><br/> <a href="wap.weather.com">The weather</a><br/> <a href="wap.jellybeans.org">One click jelly bean ordering</a> </p> </card> </wml>

Configuring Apache

By and large, the Web server doesn't need much tweaking to deliver WML pages to a wireless device. As far as Apache is concerned, it needs only to know how to recognize the MIME type of the file, based on the file's file name extension. Apache will pass this MIME type to the receiving browser and, assuming the browser knows WML, it will know what to do with a WML type file.

Recent versions of Apache can be entirely configured through the file httpd.conf, which is typically located in the apache/conf/ directory, wherever Apache is installed on the server. If you open httpd.conf in a text editor, you can scroll through and view the many, many Apache configuration directives. Ultimately, you will find a section where MIME types are declared. In the default Apache httpd.conf file, this section begins as follows (though it may vary slightly depending on the installation):

# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
# For example, the PHP3 module (not part of the Apache distribution)
# will typically use:
#AddType application/x-httpd-php3 .phtml
#AddType application/x-httpd-php3-source .phps

AddType application/x-tar .tgz

While not strictly necessary, this is a good and logical place to add WML types to Apache. So, we simply pasted the following lines to our httpd.conf file just after the last line above:

This article was originally published on Aug 17, 2000
Page 2 of 3

Thanks for your registration, follow us on our social networks to keep up-to-date