O'Reilly logo

J2ME in a Nutshell by Kim Topley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HTTP Connections

The only communications protocol that every MIDP device is required to provide is the fairly simple Hypertext Transfer Protocol (HTTP), described in RFC 2616 (available from http://www.ietf.org/rfc/rfc2616.txt). HTTP makes use of stream sockets to carry messages between an HTTP client (usually a web browser) and a web server that often (but not always) returns an HTML page to the client. This works well in the desktop environment, but there are two potential problems with bringing all this to the devices for which MIDP is intended:

  • Many of these devices, particularly cell phones, do not have a direct connection to the Internet and therefore almost certainly do not support sockets.

  • The MIDP user interface components do not provide any support for displaying HTML, so there is no built-in browser capability in a MIDP device.

It is the responsibility of the device vendor to arrange for the device to be able to support HTTP even if it does not have a direct connection to the Internet. In most cases, this means that the device needs to connect to a gateway that can switch HTTP messages to whatever protocol is used to connect to the Internet gateway. In the wireless environment, for example, the device might use WSP (the Wireless Session Protocol) to connect to a WAP gateway that can bridge between a wireless network and the Internet. However this mapping is achieved, it must be done in such a way that the MIDP application cannot tell whether it is directly connected to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required