Java Reference
In-Depth Information
Granting Permissions for Network Connections
As I indicated in the section “Putting HTTP to Work,” networked applications require
privilege. This requirement, imposed by the MIDP, ensures that applications do not
generate unauthorized network connections that may result in data use charges or in
transmitting your information to unauthorized individuals. Network access through the
GCF in the MIDP is guarded by permissions based on the type of connection your appli-
cation wants to create. Table 12-6 shows the names of these permissions.
Table 12-6. MIDP Permissions Governing Access to the GCF
Permission
Interface
javax.microedition.io.Connector.http
HttpConnection
javax.microedition.io.Connector.https
HttpsConnection
javax.microedition.io.Connector.datagram
DatagramConnection
javax.microedition.io.Connector.datagramreceiver
DatagramConnection
javax.microedition.io.Connector.socket
SocketConnection
javax.microedition.io.Connector.serversocket
ServerSocketConnection
javax.microedition.io.Connector.ssl
HttpsConnection
javax.microedition.io.Connector.comm
CommConnection
javax.microedition.io.PushRegistry
PushRegistry
By default, working in the emulator provided by NetBeans, your MIDlet runs as an
untrusted MIDlet, and connections are only available if the user grants permission for
the connection.
As I describe in Chapter 3, trusted applications must specify the privileges they
require in the JAD attributes MIDlet-Permissions and MIDlet-Permissions-Opt . The easiest
way to do this in NetBeans is by specifying this in the application's properties; choose
Properties Application Descriptor API Permissions and click the button labeled Add.
Figure 12-2 shows this screen in NetBeans.
 
Search WWH ::




Custom Search