利用Ajax组件实现Web服务异步通信的一种方法外文翻译资料

 2022-12-18 04:12

One way of using Ajax components to realize asynchronous communication in web service

IlNam Ri1,lowast;, SongIl Choe2, Hun Kim1

1 College of Information Science, Kim Il Sung University, Pyongyang, Democratic Peoplersquo;s Republic

of Korea

2 Department of Information Science, HuiChon Industry University, HuiChon, Democratic Peoplersquo;s

Republic of Korea

Corresponding author. * E-mail address: ring15822944219@163.com

Abstract- Ajax (Asynchronos Javascript And XML), one of the worlds most widely used Web 2.0 technologies, is devoid of the traditional Web page approach.(1) This technology is becoming an indispensable element in Web apps as it supports asynchronous communication that allows the user to proceed with the conversation.(3,4)

Today s reality is getting closer to the virtual reality by the dissemination of intelligent devices, the new Internet of Things, cloud computing and the development of information society.

In the field of business services, we also need to improve the size and service quality of our web apps, and Ajax technology is constantly expanding.(5)

In the fields of stocks, finance, auctions, etc. that deal with large-scale, real-time data, it is important for business service providers to transmit information to users as soon as possible.

This Paper describes one way of using Ajax components to realize asynchronous communication of Web service providers on the Internet.

Ajax components consist of an Ajax core that supports Epoll and an Ajax library that supports asynchronous communication, and provides an application interface to define and implement various push functions.(2)

Web service applications developed using Ajax components can provide various push services by using asynchronous communication with client by using Epoll method.

.Keywords- Ajax, Ajax component, Web service, Server Push

  1. Introduction

Since the introduction of Web 2.0, Web application development has evolved from a static Web site into a tInteractive Web service program based on a interaction. (3)

One of the most popular technologies for creating interactive web service applications is Ajax (Asynchronous Javascript and XML), which appeared in 2005 (Garrett 2005) and now runs a number of Web sites supporting Ajax technology.(1)

Ajax allows asynchronous requests after the page is loaded so that the JavaScript code can update some of the pages in the browser, effectively updating the data without having to reopen the entire page..

Today, as the demand for fast and accurate information such as the economy, construction, commerce, technology dissemination, and new news is increasing, the environment where information is actively provided on time is important without the request of the user..

Polling in the previous period is a representative technology for realizing the service push in the client / service model. It is a method that allows the client to send the request implicitly to the

service provider so that the information of the service provider is obtained in a timely manner when the service information is modified .

Polling has been widely used because it is easy to implement in general HTTP based applications.It is not efficient due to frequent requests to exchange network with continuous liveness of service resources..

However, with the introduction of Ajax technology, Push technology such as Long Polling (6) and HTTP Streaming (7)are being used to improve the problem of polling and to realize effective service push.

Typically, there are Pushlet, Adobes BlazeDS (9), and Weelyas APE (Ajax Push Engine).

Although these frameworks provide various functions and high performance, they do not provide a convenient environment for the developers or they do not support the development of a wide range of Web service applications due to the dependency on the execution environment.

In the paper to solve these shortcomings, we will discuss how to use Ajax components to support the development of push services for Web services.

The Ajax component consists of an Ajax core for developing a Push service that supports Epoll and an Ajax library for a push request to perform Ajax-based asynchronous communication.

The Ajax core part uses the non-blocking I / O (JavaNIO) to support Epoll, and at the same time it runs independently without being dependent on the execution environment.(8)

It also supports the infrastructure for convenient management of channels and user information for pushing information.

The Ajax library is bundled with the Push service and provides a variety of application interfaces to take advantage of Push service.

Ajax component based web service application programs can efficiently manage many referrals based on Epoll, and can provide push service with Ajax - based asynchronous communication.

The composition of the paper follows the introduction, and in Section 2 deals with the techniques and use of the previous period to realize the service push.

Section 3 describes the design and development of the Ajax core and Ajax library, and deals with protocols for effective communication.

Section 4 describes the conclusion.

  1. Analysis of Prior Research
    1. Server push technology

Server push is a communication technology in which the service provider actively provides information without the exact request of the client.

Table 1 shows representative methods for realizing server push technology in the Internet.

method

Characteristic

Long Polling

  • Used in asynchronous frameworks such as

    剩余内容已隐藏,支付完成后下载完整资料


    利用Ajax组件实现Web服务异步通信的一种方法

    IlNam Ri1,lowast;, SongIl Choe2, Hun Kim1

    1 College of Information Science, Kim Il Sung University, Pyongyang, Democratic Peoplersquo;s Republic

    of Korea

    2 Department of Information Science, HuiChon Industry University, HuiChon, Democratic Peoplersquo;s

    Republic of Korea

    Corresponding author. * E-mail address: ring15822944219@163.com

    摘要:Ajax(Asynchronos javascript And XML)是世界上使用最广泛的Web2.0技术之一,它不同于传统的网页解决方案。该技术正成为Web应用程序中不可或缺的元素,因为它支持允许用户继续进行对话的异步通信。随着智能设备的传播、新兴的物联网、云计算和信息社会的发展,当今世界越来越接近于虚拟现实。在业务服务领域,我们还需要提高Web应用程序的规模和服务质量,而Ajax技术也在不断扩展。在处理大规模实时数据的股票、金融、拍卖等领域,业务服务提供商必须尽快向用户传输信息。本文介绍了一种利用Ajax组件实现Web服务提供商在网络上异步通信的方法。Ajax组件由支持Epoll的Ajax核心和支持异步通信的Ajax库组成,并提供定义和实现各种推送功能的应用程序接口。使用Ajax组件开发的Web服务应用程序可以通过使用Epoll方法与客户端进行异步通信来提供各种推送服务。

    关键词:Ajax;Ajax组件;Web服务;服务推送

    1. 介绍

    自从Web2.0引入以来,Web应用程序开发已经从一个静态的网站演变为一个基于交互的TinteraActiveWeb服务程序。创建交互式Web服务应用程序最流行的技术之一是Ajax(Asynchronos javascript And XML),它出现在2005年(Garrett2005),现在运行着许多支持Ajax技术的网站。Ajax允许在页面加载后进行异步请求,以便javascript代码可以更新浏览器中的某些页面,从而有效地更新数据,而无需重新打开整个页面。如今,随着对经济、建筑、商业、技术传播、新新闻等快速准确信息的需求不断增加,在没有用户要求的情况下,及时主动提供信息的环境非常重要。前一阶段的轮询是在客户机/服务模型中实现服务推送的一种代表性技术。它是一种方法,允许客户端将请求隐式发送到服务提供者,以便在修改服务信息时及时获取服务提供者的信息。由于轮询在一般基于HTTP的应用程序中易于实现,因而得到了广泛的应用,由于频繁的请求交换网络,且服务资源的持续活跃,使得轮询效率不高。然而,随着Ajax技术的引入,长轮询和HTTP流等推送技术正被用于改善轮询问题,实现有效的服务推送。通常,有pushlet、adobe的blazeds和weelya的ape(ajax推送引擎)。尽管这些框架提供了各种功能和高性能,但它们并不能为开发人员提供方便的环境,或者由于依赖于执行环境而不支持广泛的Web服务应用程序的开发。为了解决这些缺点,我们将讨论如何使用Ajax组件来支持Web服务推送服务的开发。Ajax组件包括用于开发支持epoll的推送服务的Ajax核心和用于执行基于Ajax的异步通信的推送请求的Ajax库。Ajax核心部分使用非阻塞I/O(javanio)来支持Epoll,同时它独立运行,而不依赖于执行环境。它还支持方便管理渠道的基础设施和用于推送信息的用户信息。Ajax库与推送服务捆绑在一起,提供各种应用程序接口以利用推送服务。基于Ajax组件的Web服务应用程序可以有效地管理基于Epoll的许多引用,并且可以通过基于Ajax的异步通信提供推送服务。本文的组成部分是在介绍的基础上进行的,第二部分介绍了前一阶段实现服务推送的技术和使用方法。第3节描述了Ajax核心和Ajax库的设计和开发,并讨论了有效通信的协议。第4节描述了结论。

    1. 前期研究分析
      1. 服务器推送技术

    服务器推送是一种通信技术,在这种技术中,服务提供者主动提供信息,而不需要客户端的确切请求。表1显示了在网络上实现服务器推送技术的代表性方法。

    方法

    特性

    长轮询

    • 用于异步框架,如Ajax。
    • 当服务器收到客户端请求时维持关联, 以信息更改的事件响应,并结束HTTP传输。
    • 当客户端收到响应时,再次发送请求。

    HTTP流

    • 如果在服务器和客户端之间保持连接的时候发生类似实时流的信息更改事件,数据使用HTTP分块方法传输。
    • 实现和异常处理困难且不兼容。

    表1 主要的服务器推送技术

    服务推送框架

    由于服务器推送的必要性,人们开发了一个框架来有效地开发基于服务器推送的应用程序。Pushlet是一种基于Servlet的推送框架,它可以在没有Java Applet等插件的情况下,从服务器上的Java对象向客户端的DHTML(DynamicHTML)提供信息。Adobe BlazeDS是一个服务器的执行环境,用于向基于框架的客户机(如Flex或Air)通信和提供信息。Pushlet和BlazeDS支持基于HTTP流的服务器和客户端之间的异步通信。APE是一个开源的推送引擎,它提供基于Ajax的实时推送服务,由APE服务器和APE客户端组成。APE服务器作为Epoll类型的Comet服务器运行,并与APE客户端异步提供有效的信息。Epoll通过提供基于事件通知的边缘触发器和级别触发器面对面处理方法,以高速处理多个客户端。表2显示了ape的主要特性。

    APE服务器

    APE客户端

    • 使用C语言编写
    • 基于发布/订阅模式
    • 支持Linux,BSD amp; Mac OS
    • E-poll驱动程序
    • 完全异步保证服务器端JavaScript支持
    • 消息查询系统中的批处理
    • 支持可扩展服务实现
    • 基于Mootools
    • 客户端可以使用Socket API
    • 各种浏览器支持
    • 插件框架支持
    • 会话管理和多通道支持
    • 传递方法支持

    表2 APE的主要特性

    1. 开发用于Web业务服务的Ajax组件
      1. 配置Ajax组件

    Ajax组件是一个使用长轮询方法提供推送服务的框架,由用于Business Server的Ajax核心和用于客户端开发的Ajax库组成。

    开发人员可以分别使用Ajax核心库和Ajax库来实现推送应用程序的服务器和客户端,普通用户可以通过该客户端轻松使用服务器的推送服务。

    基于Ajax组件的推送应用的操作过程如下。

    (1)向用户请求信息

    (2)Ajax库工作并请求推送服务器

    (3)推送服务器请求验证和客户端重新连接信息存储

    (4)发生服务器信息更改事件

    (5)向连接的客户端推送信息

    (6)从客户端接收信息后处理Ajax库

    (7)重复步骤2到7,直到用户取消请求。

    当请求用户请求的信息时,Ajax库使用Ajax XHR(xmlhttprequest)对象,用于基于Ajax核心连接到推送服务器并请求信息。XHR对象提供了一个长轮询方法,使客户机能够在独立于客户机中的用户界面运行的情况下异步与服务器通信。XHR对象使用Java脚本对象标记(JSON)对象进行信息表示,并与服务器交换信息。Ajax库通过应用XHR对象定义推送服务,并定义实现推送服务的各种功能,并提供推送程序的客户端开发环境。Ajax核心使用Java NIO选择器类来处理客户端连接和请求。它还使用一个称为通道的通信通道作为对连接的客户机进行分类和存储的手段。通道由服务器的XML元文件定义,用户可以动态创建和修改。连接的客户机由对象表示并存储在服务器的指定通道上。当要提供给相应通道的信息出现时,存储在通道中的连接对象用于向客户机传输信息。Ajax核心通过提供定义这些通道和有效提供信息的功能来提供推送服务器开发。

    图1显示了基于Ajax组件的业务服务推送应用程序的总体结构。

    Web Server Ajax Component

    Ajax core

    Data Base

    Meta Data

    User

    Web Browser

    Web Page

    Ajax Component

    Ajax Library

    Java Script

    User n

    图1 基于Ajax组件推送程序的总体结构

    Ajax核心

    Ajax核心是推送服务器开发的框架,定义了在服务器上实现推送服务的关键功能。通过将此函数作为抽象函数提供,可以通过应用此函数轻松实现推送服务器。图2显示了Ajax核心内部类的总体结构。

    Ajax core Handler JavaPushEngin OptionProcess PushControl

    Server

    Interface

    AjaxChannel FilePush

    Manager

    BlackListXML Manager

    ChannelXML Manager

    ChannelXML

    RssReader

    ClientManager

    TextPush

    Read

    SubStringClass

    Push

    DataPush

    ChAttribute

    Manager

    UserXML

    OptionRead

    图2 Ajax核心结构

    Ajax核心的核心包负责设置执行推送服务的基本执行环境,如初始化和客户端连接。推送服务器执行和向客户机提供信息的过程如下。

    (1)创建核心包的服务器类对象时,对push服务进行初始化

    (2)当客户端连接并传递通知消息时,handler类对象将此消息转发给pushcontrol类对象。

    (3)pushControl对象通过chattbuteManager对象检索通道,并调用指向通道的通道管理器对象以提供信息。

    (4)clientManager对象通过channelManager对象从channelManager对象加载,push包的datapush对象用于向客户端提供信息。

    Ajax核心为推送服务提供了一个javapushenine类。javapushenine类支持filepush、rssreader和textpush对象在内部推送各种类型的数据,并将它们作为抽象函数提供,以便push服务器开发人员可以轻松地开发push服务。Ajax核心通过XML配置文件在结构上管理通道或用户相关信息。通道列表和用户文件分别记录通道和用户的详细信息,Ajax核心可以使用channelAjax类来检索或修改该文件中的必要信息。Ajax核心使用一个通道来表示有效的信息分类和客户机列表。ChannelManager类提供对存储在通道列表中的通道列表和列表中客户端列表的分层访问。

    图3显示了根据Ajax组件客户机进行通道管理的分层数据结构。

    ChannelManager

    Layer

    ChAttributeManager

    Layer

    ClientManager

    Layer

    A Channel

    Client1

    Client2

    B Channel

    B Channel

    Client3

    Client4

    A Channel

    图3 客户端管理通道的多层结构

    中间层的chattributeManager类存储可以有效利用通道的各种功能的属性。表3显示了组成通道的属性和函数。

    属性

    作用

    title

    通道名称

    m

    剩余内容已隐藏,支付完成后下载完整资料


    资料编号:[20075],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

课题毕业论文、文献综述、任务书、外文翻译、程序设计、图纸设计等资料可联系客服协助查找。