Java Reference
In-Depth Information
2.6.5 Security Policy for Network Connections
The connections discussed above are part of the Net Access function
group (see the RSP addendum to the MIDP specification). On the Nokia
N95, for example, an untrusted MIDlet can access the Net Access function
group with User permission (explicit confirmation required from the user).
Figure 2.17 shows an example of an unsigned MIDlet, Google's Gmail,
and the available permission options on a Nokia N95. This policy varies
from licensee to licensee so you must check with the manufacturer of
your target devices which settings apply for existing security domains.
Figure 2.17 Permission options for an unsigned MIDlet on a Nokia N95
NetworkDemo MIDlet
We finish this section with a simple example using MIDP's javax. to interrogate a web server.
The NetworkDemo MIDlet connects to a web server via HttpConnec-
tion , and reads and displays all the headers and the first 256 characters
of the response itself. Let's take a look at the core network function-
ality exploited in this MIDlet. The connection work is all done in the
ClientConnection class:
public class ClientConnection extends Thread {
private static final int TEXT_FIELD_SIZE = 256;
private NetworkDemoMIDlet midlet = null;
private String url = null;
Search WWH ::

Custom Search