Chapter 6. Sending Multimedia Content

Until now, every servlet we’ve written has returned a standard HTML page. The web consists of more than HTML, though, so in this chapter we’ll look at some of the more interesting things a servlet can return. We’ll start by looking at the new WAP protocol and the WML markup language used by cell phones and mobile devices and see how servlets can use this new technology. Then we’ll show how to generate images dynamically from a servlet to create charts and manipulate pictures. Toward the end of the chapter we’ll explore when and how to send a compressed response and examine using multipart responses to implement server push.

WAP and WML

The Wireless Application Protocol (WAP, pronounced like whap) is a de facto standard for providing Internet communications to mobile phones, pagers, and personal digital assistants (PDAs) on wireless networks across the world. It was created in 1998 by Ericsson, Nokia, Motorola, and Phone.com (formerly Unwired Planet) who wisely desired to create a standard protocol rather than competing proprietary protocols. Together the four companies founded the WAP Forum (http://www.wapforum.org), a democratically organized group whose participation has since grown to more than 400 members.

WAP consists of a set of specifications for developing applications to run on wireless networks. The WAP Protocols covers both the application level (the WML markup language and the WMLScript scripting language, collectively ...

Get Java Servlet Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.