tailieunhanh - Flash Builder 4 and Flex 4 Bible- P18
Flash Builder 4 and Flex 4 Bible- P18: When Macromedia first released Flash MX in 2002, the product was branded as the new way to build Rich Internet Applications (known by the acronym RIA). The term was invented at Macromedia to describe a new class of applications that would offer the benefits of being connected to the Internet, including access to various types of Web-based services, but would solve many of the nagging issues that had been inherent in browser-based applications since the mid-1990s | Chapter 26 Integrating Flex Applications with BlazeDS and Java Note Desktop Flex applications deployed with Adobe AIR don t need to use the Proxy Service. These applications aren t downloaded from the Web at runtime so they aren t subject to the rules of the Web security sandbox and can make runtime requests directly to any domain. The application in Listing uses a proxied request for data in an XML file stored on the server. LISTING A Flex application using the Proxy Service xml version encoding utf-8 s Application xmlns fx http mxml 2009 xmlns s library flex spark xmlns mx library flex mx fx Declarations s HTTPService id contactService useProxy true url http 8400 blazeds flex4bible data result resultHandler event fault faultHandler event fx Declarations s layout s VerticalLayout horizontalAlign center paddingTop 20 s layout fx Script CDATA import import import import Bindable private var myData ArrayCollection private function resultHandler event ResultEvent void myData private function faultHandler event FaultEvent void fx Script s Button label Get Data click mx DataGrid dataProvider myData s Application 821 Part IV Integrating Flex Applications with Application Servers On the Web The code in Listing is available in the Web site files as in the src folder of the chapter26 project. When you run the application in its current state it correctly downloads and displays the requested data. If you remove the HTTPService component s useProxy property or set it to false the request fails because the domain of the XML file and the domain from which the application is downloaded don t match. The result is a security fault as shown in Figure . FIGURE A Flex
đang nạp các trang xem trước