Products
Technologies

Developer resources

How to use BlazeDS Remoting

Avg. Rating 3.1

Problem

You need to improve your data transfer performance. You also want to be able to directly invoke methods of Java objects deployed in your application server.

Solution

Using the BlazeDS RemoteObject, you can directly invoke methods of Java objects deployed in your application server, and consume the return value. The return value can be a value of a primitive data type, an object, a collection of objects, an object graph, etc.

Detailed explanation

Using RemoteObject is easy:
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    
    <mx:RemoteObject id="srv" destination="product"/>
    
    <mx:DataGrid dataProvider="{srv.getProducts.lastResult}" width="100%" height="100%"/>
 
    <mx:Button label="Get Data" click="srv.getProducts()"/>    
        
</mx:Application>
The value of the destination property of RemoteObject is a logical name that is mapped to a fully qualified java class in remoting-config.xml.

Java objects returned by server-side methods are deserialized into either dynamic or typed ActionScript objects. In this example, we don't have an explicit ActionScript version of the Product Java class. Product objects are therefore deserialized into dynamic objects. In sample 5, we work with an explicit Product class in ActionScript.

Report abuse

Related recipes