MIDP Connectivity
The MIDP extends the CLDC Generic Connection Framework to provide support for the HTTP protocol. Why HTTP? Well, HTTP can be implemented using both IP protocols (such as TCP/IP) or non-IP protocols (such as WAP and I-mode). In the latter case, the device would have to utilize a gateway that could perform URL naming resolution to access the Internet, as shown in Figure 7-2.
Figure 7-2. The benefit of HTTP support
Tip
All of the MIDP 1.0 implementations must provide support for the HTTP protocol. Therefore, we encourage you to only use protocols supported by the MIDP (i.e., HTTP), as this will allow the application to be portable across all mobile information devices.
The idea of having the MIDP support the HTTP protocol is very clever. For network programming, you can revert to the HTTP programming model, and your applications will run on any MIDP device, whether it is a GSM phone with a WAP stack, a phone with I-mode, a Palm VII wireless, or a handheld device with Bluetooth.
The HttpConnection Interface
The
HttpConnection
interface is part of the
javax.microedition.io
package. This interface defines the
necessary methods and constants to exchange data through an HTTP
connection. It has the following methods (the constants, which have
been omitted here to save space, are documented in Appendix D):
public interface HttpConnection extends ContentConnection { // public ...
Get Wireless Java 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.