Главная » Просмотр файлов » Programming Java 2 Micro Edition for Symbian OS 2004

Programming Java 2 Micro Edition for Symbian OS 2004 (779882), страница 24

Файл №779882 Programming Java 2 Micro Edition for Symbian OS 2004 (Symbian Books) 24 страницаProgramming Java 2 Micro Edition for Symbian OS 2004 (779882) страница 242018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 24)

In addition, tobe effective the MIDlet signing process needs to be associated with acertification scheme run by the relevant stakeholder’s developer program.At the time of writing the infrastructure for the RSP is not yet fully inplace, thus the current MIDP 2.0 phones based on Symbian OS arenot fully compliant with the RSP. In the future this is likely to changeas certification programs under development, such as the Java VerifiedProgram for J2ME (www.javaverified.com), become established.3.3.3 Over-the-Air ProvisioningThe MIDP 1.0 specification provided a recommended practice for overthe-air (OTA) provisioning, but it was not a mandatory requirement thatMIDP 1.0 implementations supported it.

With the release of MIDP 2.0,support for user-initiated OTA provisioning became a mandatory part ofthe specification.Symbian’s MIDP implementation has provided the necessary supportfor OTA provisioning since MIDP 1.0. Therefore MIDP 1.0 devices suchas the Nokia Series 60 N-Gage, 7650, 3650, 3660 and 3620 all supportOTA provisioning, as does the Sony Ericsson P800. Naturally, SymbianOS-based MIDP 2.0 devices also support OTA provisioning.108MIDP 2.0 AND THE JTWI3.3.4 Connection Framework3.3.4.1 What’s Optional and What’s NotThe CLDC provides a Generic Connection Framework (GCF), which is anextensible framework that can be customized by a J2ME profile to supportthe necessary networking protocols required by that vertical device category.

The MIDP 1.0 specification only required support (in other words,a concrete implementation) for the HTTP protocol. The MIDP 2.0 specification extends the support required for networking protocols to includemandatory support for HTTPS. The MIDP 2.0 specification also statesthat implementations should (where ‘‘should’’ implies a recommendedpractice that can be ignored only in exceptional circumstances) providesupport for sockets, secure sockets, server sockets and datagrams. Support for serial port access via the CommConnection interface is optionalunder the MIDP 2.0 specification.Symbian’s implementation of MIDP 2.0 complies with the specification, providing implementations for all of the above except the optionalserial port access. So, Symbian’s MIDP 2.0 currently provides implementations of the following protocols:• HTTP• HTTPS• sockets• server sockets• secure sockets• datagrams.In the following sections we will explore using these connections in alittle more detail.3.3.4.2 HTTP and HTTPS SupportHTTP connections have been supported since MIDP 1.0.

To open anHTTP connection we use the Connector.open() method with a URLof the form www.myserver.com.So code to open an HttpConnection and obtain an InputStreamwould look something like this.try{String url = "www.myserver.com";HttpConnection conn = (HttpConnection)Connector.open(url);InputStream is = conn.openInputStream();...conn.close()}catch(IOException ioe){...}MIDP 2.0109Under the MIDP 2.0 security model, untrusted MIDlets can open anHTTP connection only with explicit user confirmation. Signed MIDletsthat require access to an HTTP connection must explicitly requestthe javax.microedition.io.Connector.http permission in theMIDlet-Permissions attribute:MIDlet-Permissions: javax.microedition.io.Connector.http, ...The MIDP 2.0 specification adds the requirement that implementations must support the HTTPS protocol, which implements HTTP over asecure network connection via the Secure Sockets Layer (SSL).

Openingan HTTPS connection follows the same pattern as a normal HTTP connection, with the exception that we pass in a connection URL of the formhttps://www.mysecureserver.com and cast the returned instanceto an HttpsConnection object, as in the following example of codefor interrogating a secure server for security information associated withthe connection.try{String url = "https://www.mysecureserver.com";HttpsConnection hc = (HttpsConnection)Connector.open(url);SecurityInfo info = hc.getSecurityInfo();String protocolName = info.getProtocolName();String protocolVersion = info.getProtocolVersion();String cipherSuite = info.getCipherSuite();Certificate c = info.getServerCertificate();String name = c.getIssuer();...}catch(IOException ioe){...}The MIDP 2.0 specification requires that MIDlets in untrusted MIDletsuites be able to open HTTPS connections with User permission.

A signedMIDlet suite which contains MIDlets that open HTTPS connections mustexplicitly request the javax.microedition.io.Connector.httpspermission in its MIDlet-Permissions attribute:MIDlet-Permissions: javax.microedition.io.Connector.https, ...3.3.4.3 Socket and Server Socket SupportAlthough support for socket connections was an optional part of the MIDP1.0 specification, MIDP 2.0 now makes support for socket connectionsa recommended practice. Socket connections come in two forms: clientconnections in which a socket connection is opened to another host; andserver connections in which the system listens on a particular port for110MIDP 2.0 AND THE JTWIincoming connections from other hosts. The connections are specifiedusing Universal Resource Identifiers (URI).You should be familiar with the syntax of a URI from Web browsing.They have the format <string1>://<string2> where <string1>identifies the communication protocol to be used (e.g.

http) and<string2> provides specific details about the connection. The protocolmay be one of those supported by the Generic Connection Framework(see Section 2.1.3.2).To open a client socket connection to another host we pass a URI ofthe following form to the connector’s open() method:socket://www.symbian.com:80The host may be specified as a fully qualified hostname or IPv4 addressand the port number refers to the connection endpoint on the remotepeer. Some sample code is shown below:SocketConnection sc = null;OutputStream out = null;try{sc = (SocketConnection)Connector.open ("socket://localhost:79");...out = c.openOutputStream();...}catch(IOException ioe){...}A server socket connection is used for listening for inbound socketconnections.

To obtain a server socket connection we can pass a URI ineither of the following forms to the connector’s open() method:socket://:79socket://In the first case the system listens for incoming connections on port79 (of the local host). In the latter case, the system allocates an availableport for the incoming connections.ServerSocketConnection ssc = null;InputStream is = null;try{ssc = (ServerSocketConnection)Connector.open(“socket://:1234”);SocketConnection sc = (SocketConnection)ssc.acceptAndOpen();...is = sc.openInputStream();...}catch(IOException ioe){...}MIDP 2.0111The ServerSocketConnection interface extends the StreamConnectionNotifier interface. To obtain a connection object for anincoming connection the acceptAndOpen() method must be calledon the ServerSocketConnection instance.

An inbound socket connection results in the call to the acceptAndOpen() method, returninga StreamConnection object which can be cast to a SocketConnection as desired.The SocketConnection interface defines several useful methodsincluding:public void setSocketOption(byte option, int value)This allows the developer to set several socket options using thefollowing public static final byte constants defined in SocketConnection:• DELAYA value of zero disables the use of Nagle’s algorithm – written datais not buffered pending acknowledgement of previously written data.This may be desirable when sending and receiving small packets ofdata, for instance, in a peer-to-peer messenger application.• LINGERA non-zero value represents the interval in seconds that the systemwill continue to try to process queued data after the close() methodhas been called.

After the interval has elapsed the connection will beforcefully closed with a TCP RST. A value of zero disables linger onclose.• KEEPALIVEIf enabled (by a non-zero value), a keepalive probe will be sent to theremote peer after an implementation-specific time interval (the defaultis two hours) if no other data has been sent or received on the socketduring that time interval. The purpose of the probe is to detect if thepeer has become unreachable. The peer can respond in one of threeways: a TCP ACK response indicating all is well – no action is taken; aTCP RST response indicating the peer has crashed and been rebootedin which case the socket is closed; no response from the remotepeer – the socket is closed.

A value of zero disables this feature.• RCVBUFThis option is used by the platform’s networking code as a hint for thesize at which to set the underlying network I/O receiving buffer.• SNDBUFThis option is used by the platform’s networking code as a hint for thesize to set the underlying network I/O sending buffer.112MIDP 2.0 AND THE JTWIA signed MIDlet suite which contains MIDlets which open socketconnections must explicitly request the javax.microedition.io.Connector.socket permission (needed to open client connections) and if required the javax.microedition.io.Connector.serversocket permission (needed to open server connections), in itsMIDlet-Permissions attribute, for example:MIDlet-Permissions: javax.microedition.io.Connector.socket, ...or:MIDlet-Permissions: javax.microedition.io.Connector.socket,javax.microedition.io.Connector.serversocket, ...If the protection domain to which the signed MIDlet suite would bebound grants, or potentially grants, these permissions, then the MIDletsuite will be installed and the MIDlets it contains will be able to opensocket connections, either automatically or with user permission, depending upon the security policy in effect on the device for the protectiondomain to which the MIDlet suite has been bound.Whether MIDlets in untrusted MIDlet suites can open socket connections depends on the security policy relating to the untrusted domain inforce on the device.3.3.4.4 Secure Socket SupportSecure socket connections are client socket connections over SSL.

Toopen a secure socket connection we pass in a hostname (or IPv4 address)and port number to the connector’s open() method using the followingURI syntax:ssl://hostname:portWe can then use the secure socket connection in the same manner asa normal socket connection, for example:try{SecureConnection sc = (SecureConnection)Connector.open("ssl://www.secureserver.com:443");...OutputStream out = sc.openOutputStream();...InputStream in = sc.openInputStream();...}catch(IOException ioe){...}MIDP 2.0113A signed MIDlet suite that contains MIDlets which open secure connections must explicitly request the javax.microedition.io.Connector.ssl permission in its MIDlet-Permissions attribute, forexample:MIDlet-Permissions: javax.microedition.io.Connector.ssl, ...If the protection domain to which the signed MIDlet suite would bebound grants, or potentially grants, this permission, the MIDlet suite canbe installed and the MIDlets it contains will be able to open secureconnections, either automatically or with user permission, depending onthe security policy in effect.Whether MIDlets in untrusted MIDlet suites can open secure connections depends on the permissions granted in the untrusted protectiondomain.3.3.4.5 Datagram SupportSymbian’s MIDP 2.0 implementation includes support for sending andreceiving UDP datagrams.

Характеристики

Тип файла
PDF-файл
Размер
5,73 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6294
Авторов
на СтудИзбе
314
Средний доход
с одного платного файла
Обучение Подробнее