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 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 ...

Get J2ME in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.