Motorola manual Https, Supported Protocols on the i88s Phone

Page 16

Motorola Inc.

i88s J2ME Developers’ Guide

Applications requesting a network resource for any protocol must use one of the three methods above. The URL is the distinguishing argument that determines the difference between HTTP, UDP, Serial, etc. The following chart details the prefixes that should be used for the supported protocols.

Table 2-1: Supported Protocols on the i88s Phone

Protocol

URL Format

HTTP

http://

HTTPS

https://

TCP Sockets

socket://

SSL Secure Sockets

ssocket://

Server Sockets

serversocket://

UDP Sockets

datagram://

Serial Port

comm:0;

2.2.1HTTP

The HTTP implementation follows the MIDP 1.0 standard. The Connector.open() methods return a HttpConnection object that is then used to open streams for reading and writing. The following is a code example:

HttpConnection hc = (HttpConnection)Connector.open(“http://www.motorola.com/”);

In this particular example, the standard port 80 is used, but this parameter can be specified as shown in the following example:

HttpConnection hc = (HttpConnection)Connector.open(“http://www.motorola.com:8080”);

The other static Connector methods work in the same manner, but they provide the application additional control in dealing with the properties of the connection. By default, HTTP 1.1 persistency is used to increase efficiency while requesting multiple pieces of data from the same server. In order to disable persistency, set the “Connection” property of the HTTP header to “close”.

2.2.2HTTPS

The HTTPS implementation follows the MIDP 1.0 standard, save for the security aspects. The Connector.open() methods return a HttpConnection object that is then used to open streams for reading and writing. The following is a code example:

HttpConnection hc = (HttpConnection)Connector.open(“https://www.motorola.com/”);

Version 1.0 - Page 16

Image 16
Contents I88s Multi-Communication Device J2ME Developers’ Guide J2ME Networking Document Overview DisclaimerAcronyms and Definitions Contact InformationAcronyms Used In This Guide Terminology Definition Agps On The i88s Phone OverviewAccuracy Position APIAssist Data Almanac Out Of Date PositionConnection ClassExample Method Descriptions Retrieving Position in JavaGetPosition GetPositionString nameUsing Position in Java GetStatusExample Using PositionConnection Positionresponsenoalmanacoverride Addition, to obtain better accurate speed and direction Recommendation J2ME Networking Http HttpsClass Descriptions Https HttpSupported Protocols on the i88s Phone SSL Secure Sockets TCP SocketsServerSockets Serial Port Access UDP SocketsConnection Optional Parameters Communicating on a PortExample using StreamConnection Implementation NotesTips Concurrent Connections For The i88s Phone Protocol MaximumClass Description File I/OMethod Descriptions Opening a file Reading and Writing Deleting a fileCode Examples Example # 2 Complete MIDlet code Motorola Inc I88s J2ME Developers’ Guide Os = sc.openOutputStream //get InputStream Sc.close Caveats Motorola Inc I88s J2ME Developers’ Guide
Related manuals
Manual 43 pages 17.94 Kb