1.3. Leveraging Services to Access External Data
Except for the most trivial or rare situations, application data will almost always reside outside your Flex application. It could be in a relational database, a file system, or some other persistent data store. Whichever form it is in, you would require it to be available over a network-accessible resource like a web server. In addition, you would require that the server be a safe and trusted destination that respects the security sandbox requirements of the Flash Player. Web servers at remote destinations define the required security policy in a file called crossdomain.xml, which lies at the root of the server.
Embedded DataData files can be embedded into Flex applications and distributed as a part of the application's .swf. However, doing so bloats the application size and thereby delays the application startup. In addition, the data set is static, and any modification to it requires recompilation. |
1.3.1. Using Simple HTTP and REST Style Invocations
One of the simplest ways to consume external data in Flex applications is to leverage the established methods that make the Web work. Flex applications are capable of making HTTP calls to external web servers and fetching documents, data, and resource representations from them. A component called HTTPService facilitates the process of making requests to and handling responses from a web server.
To illustrate further, we will walk through a simple example, in which we leverage ...
Get Professional BlazeDS: Creating Rich Internet Applications with Flex® and Java® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.