|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|
|CommConnection||This interface defines a logical serial port connection.|
|Connection||This is the most basic type of generic connection.|
|ContentConnection||This interface defines the stream connection over which content is passed.|
|Datagram||This class defines an abstract interface for datagram packets.|
|DatagramConnection||This interface defines the capabilities that a datagram connection must have.|
|HttpConnection||This interface defines the necessary methods and constants for an HTTP connection.|
|HttpsConnection||This interface defines the necessary methods and constants to establish a secure network connection.|
|InputConnection||This interface defines the capabilities that an input stream connection must have.|
|OutputConnection||This interface defines the capabilities that an output stream connection must have.|
|SecureConnection||This interface defines the secure socket stream connection.|
|SecurityInfo||This interface defines methods to access information about a secure network connection.|
|ServerSocketConnection||This interface defines the server socket stream connection.|
|SocketConnection||This interface defines the socket stream connection.|
|StreamConnection||This interface defines the capabilities that a stream connection must have.|
|StreamConnectionNotifier||This interface defines the capabilities that a connection notifier must have.|
|UDPDatagramConnection||This interface defines a datagram connection which knows it's local end point address.|
|Connector||This class is factory for creating new Connection objects.|
|ConnectionNotFoundException||This class is used to signal that a connection target cannot be found, or the protocol type is not supported.|
MID Profile includes networking support based on the
Generic Connection framework from the Connected,
Limited Device Configuration.
In addition to the
classes specified in the Connected Limited Device Configuration
the Mobile Information Device Profile includes the following
interface for the HTTP access. An
HttpConnection is returned
Connector.open() when an
connection string is accessed.
The MIDP extends the connectivity support provided by the Connected, Limited Device Configuration (CLDC) with specific functionality for the GenericConnection framework. The MIDP supports a subset of the HTTP protocol, which can be implemented using both IP protocols such as TCP/IP and non-IP protocols such as WAP and i-Mode, utilizing a gateway to provide access to HTTP servers on the Internet.
The GenericConnection framework is used to support client-server and datagram networks. Using only the protocols specified by the MIDP will allow the application to be portable to all MIDs. MIDP implementations MUST provide support for accessing HTTP 1.1 servers and services.
There are wide variations in wireless networks. It is the joint responsibility of the device and the wireless network to provide the application service. It may require a gateway that can bridge between the wireless transports specific to the network and the wired Internet. The client application and the Internet server MUST NOT need to be required to know either that non-IP networks are being used or the characteristics of those networks. While the client and server MAY both take advantage of such knowledge to optimize their transmissions, they MUST NOT be required to do so.
For example, a MID MAY have no in-device support for the Internet Protocol (IP). In this case, it would utilize a gateway to access the Internet, and the gateway would be responsible for some services, such as DNS name resolution for Internet URLs. The device and network may define and implement security and network access policies that restrict access.
The GenericConnection framework from the CLDC provides the base stream and content interfaces. The interface HttpConnection provides the additional functionality needed to set request headers, parse response headers, and perform other HTTP specific functions.
The interface MUST support:
Each device implementing the MIDP MUST support opening connections using the following URL schemes (RFC2396 Uniform Resource Identifiers (URI): Generic Syntax)
Each device implementing the MIDP MUST support the full specification of RFC2616 HEAD, GET and POST requests. The implementation MUST also support the absolute forms of URIs.
The implementation MUST pass all request headers supplied by the application and response headers as supplied by the network server. The ordering of request and response headers MAY be changed. While the headers may be transformed in transit, they MUST be reconstructed as equivalent headers on the device and server. Any transformations MUST be transparent to the application and origin server. The HTTP implementation does not automatically include any headers. The application itself is responsible for setting any request headers that it needs.
Connections may be implemented with any suitable protocol providing the ability to reliably transport the HTTP headers and data.(RFC2616 takes great care to not to mandate TCP streams as the only required transport mechanism.)
The HTTP 1.1 specification provides a rich set of request and response headers that allow the application to negotiate the form, format, language, and other attributes of the content retrieved. In the MIDP, the application is responsible for selection and processing of request and response headers. Only the User-Agent header is described in detail. Any other header that is mutually agreed upon with the server may be used.
For the MIDP, a simple User-Agent field may be used to identify the current device. As specified by RFC2616, the field contains blank separated features where the feature contains a name and optional version number.
The application is responsible for formatting and requesting that the User-Agent field be included in HTTP requests via the setRequestProperty method in the interface javax.microedition.io.HttpConnection. It can supply any application-specific features that are appropriate, in addition to any of the profile-specific request header values listed below.
Applications are not required to be loaded onto the device using HTTP. But if they are, then the User-Agent request header should be included in requests to load an application descriptor or application JAR file onto the device. This will allow the server to provide the most appropriate application for the device.
The user-agent and accept-language fields SHOULD contain the following features as defined by system properties using java.lang.System.getProperty. If multiple values are present they will need to be reformatted into individual fields in the request header.
|microedition.profiles||A blank (Unicode U+0020) separated list of the J2ME profiles that this device supports. For MIDP 2.0 devices, this property MUST contain at least “MIDP-2.0”.|
|microedition.configuration||The J2ME configuration supported by this device. For example, “CLDC-1.0.”|
|microedition.locale||The name of the current locale on this device. For example, “en-US.”|
User-Agent: Profile/MIDP-2.0 Configuration/CLDC-1.0
StreamConnections have one underlying
InputStream and one
OutputStream. Opening a
DataInputStream counts as opening an
and opening a
DataOutputStream counts as opening an
OutputStream. Trying to open another
OutputStream from a
IOException. Trying to open
OutputStream after they have been closed causes an
After calling the
close method, regardless of open streams,
further method calls to connection will result in
for those methods that are declared to throw
For the methods that do not throw exceptions, unknown results may be
The methods of
StreamConnections are not synchronized.
The only stream method that can be called safely in another thread is
close is invoked on a stream that is
excuting in another thread, any pending I/O method MUST throw an
InterruptedIOException. In the above case implementations
SHOULD try to throw the exception in a timely manner. When all open streams
have been closed, and when the
StreamConnections is closed,
any pending I/O operations MUST be interrupted in a timely manner.
Since the MIDP 2.0 release additional interfaces are available for secure
communication with WWW network services. Secure interfaces are provided
by HTTPS and SSL/TLS protocol access over the IP network. Refer to the
package documentation of
javax.microedition.pki for the details
of certificate profile that applies to secure connections. An
HttpsConnection is returned from
“https://” connection string is accessed.
SecureConnection is returned from
“ssl://” connection string is accessed.
Since the MIDP 2.0 release, the MIDP specification also includes optional networking support for TCP/IP sockets and UDP/IP datagrams. For each of the following schemes, a host is specified for an outbound connection and the host is omitted for an inbound connection. The host can be a host name, a literal IPv4 address or a literal IPv6 addresss (according to RFC2732 square bracket characters ’[’ ’]’ may be used to designate an IPv6 address in URL strings). Implementations MUST be able to parse the URL string and recognize the address format used, but are not required to support all address formats and associated protocols.
When the host and port number are both omitted from the
datagram connection, the system will allocate an available
port. The host and port numbers allocated in this fashion can be discovered
The colon (:) may be omitted when the connection string does not include
the port parameter.
SocketConnection is returned from
“socket://host:port” connection string is
ServerSocketConnection is returned from
Connector.open() when a
connection string is accessed. A
is returned from
Connector.open() when a
“datagram://host:port” connection string is
PushRegistry is available in the MIDP 2.0 release which
provides a MIDlet with a means of registering for network connection events,
which may be delivered when the application is not currently running.
CommConnection is available in the MIDP 2.0 release which
provides a MIDlet with a means of registering for network accessing a local
serial port as a stream connection.
The security model is found in the package
and provides a framework that allows APIs and functions to be
restricted to MIDlet suites that have been granted permissions either by
signing or explicitly by the user. (See Security for MIDlet suites for
details about granting specific permissions to a
The risks associated with a MIDlet suite’s use of the network are related the potential for network abuse and to costs to the device owner since network use may result in charges. MIDP 2.0 provides a security framework in which network functions can be protected and allowed only to those applications that have requested and been granted appropriate permissions.
Each protocol is accessed by invoking
javax.microedition.io.Connector.open with a URI including
the protocol and arguments. The permissions below allow access to be
granted individually to protocols. The functionality of the protocols is
specified by subclasses of
Connection interface that defines
the syntax of the URI and any protocol specific methods. Devices are NOT
REQUIRED to implement every protocol. If a protocol is implemented,
the security framework specifies the naming of permissions according to the
package and class name of the APIs used to access the protocol extended
with the protocol name. The API providing access is
javax.microedition.io.Connector.open. The table below defines
the corresponding permissions for the protocols defined within this
PushRegistry is protected using the security framework and
permissions. The MIDlet suite must have the
javax.microedition.io.PushRegistry permission to register
an alarm based launch, to register dynamically using the
PushRegistry, to make a static registration in the application
descriptor and to determine if the user needs to be prompted prior to
invoking MIDlet suite in response to a Push connection event or alarm.
The protection domain defines the general behavior for user permissions
with the interaction modes of “oneshot”, “session”,
and “blanket”. For the
PushRegistry and the
AMS, launching behavior is specialized:
PushRegistryrequest; for example to register an alarm or a connection.
PushRegistryrequest; for example to register an alarm or a connection. Subsequently, when a MIDlet uses the
PushRegistrythe user is not prompted.
The push mechanism uses protocols in which the device is acting as the server and connections can be accepted from other elements of the network. To use the push mechanisms the MIDlet suite will need the permission to use the server connection. For example, to register a chat program that can be started via push might use the following attributes in the manifest:
MIDlet-Push-1: socket://:79, com.sun.example.SampleChat, *
Permissions: javax.microedition.io.PushRegistry, javax.microedition.io.Connector.servers
|PREV PACKAGE NEXT PACKAGE||FRAMES NO FRAMES|
ing HTML relo