15.4. Sample Code (NetClientMIDlet.java)

The following application, NetClientMIDlet, demonstrates how HTTP can be used to log in to a server, send data, and receive a response.

The MIDlet begins by displaying the instructional screen shown in the top figure. If the user selects OK, the MIDlet sends a POST request that contains a user identifier and password for a basic authentication scheme. It also sends the message Esse quam videri (“To be rather than to seem.”)

After sending the message, the MIDlet reads the returned values. A screen full of ...

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second 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.