Posts in Category "FDS"

BlazeDS Beta 1

Blaze DS Beta 1 on Adobe Labs!

I’m not sure if the announcement of BlazeDS has quite sunk in yet, but with the open sourcing of BlazeDS this really does make many Flex applications that much easier to build.

For example, I’d really like people to see the community take advantage of the Proxy Service and to contribute to its functionality going forward.

The Proxy Service is often overlooked, but did you know that it provides the following capabilities?

1. It provides better REST functionality with support for HTTP 1.1 PUT, DELETE, HEAD, TRACE, OPTIONS in addition to just GET and POST methods?

2. It provides access to non-UTF8 formatted text as the Proxy should be able to read in many more character set encodings – because it is Java based the stream will be converted into UCS-2 internally and then the Proxy will always format this data back to the Flash Player as UTF-8?

3. It allows 3rd party URLs to be aliased so that they do not have to be hard coded or exposed in your application (and Proxy destinations can also be locked down so that only authorized users can tunnel though to a 3rd party destination).

4. It provides a way to get back the response data even when the HTTP status code is not 200?

5. It provides a way to login to a 3rd party endpoint that issues a Basic Authentication challenge without exposing the pop-up to the end user (that is, you can build a custom Flex UI as a login form and set the remote credentials for the proxy to use in pre-authenticating to a 3rd party endpoint).

Also, there’s more that could be done here. Features that I’d like to see in the future:

A. Restoring the ability to stream back binary data instead of just text data.

B. Multipart POST support.

C. Maybe further WEBDAV support?

Flex Camp Boston – Presentation Slides

There was a lot of technical information in my presentation that you probably didn’t get a chance to write down, so here’s a PDF of the slides!

Download file

LiveCycle Data Services 2.5 on Adobe Labs

A public pre-release version of Adobe LiveCycle Data Services 2.5 is now available!

Custom Serialization using IExternalizable

I started a blog to document solutions to questions that I found myself frequently answering on the Flex forums. So the first topic up for discussion is using custom serialization with value objects in RemoteObject. This solution takes advantage of the ActionScript 3 API flash.utils.IExternalizable which is compatible with Java’s API. By implementing these interfaces on the client and server your value objects can take control of their serialization and customize what data is sent over the wire.

A common use case for using externalizable classes is to include read-only properties in serialization. While there are other approaches to achieve this for server code, there aren’t many approaches available for client code. The server uses the Java Beans API when serializing classes so one could change their value objects to implement java.beans.BeanInfo to customize introspection, however there isn’t an equivalent for this in ActionScript. This may be fine if data is not editable on the client – but many applications involve data manipulation so read-only information needs to be transmitted to maintain the idenity and/or state of an instance. A simpler, brute-force approach might be to track when a setter has been called and throw an error if it is called again – but the fact that your value object had read-only properties wouldn’t be obvious from your API.

So, for an elegant solution that works for both the client and server we are left with the option of making our classes externalizable for two-way custom serialization. Thankfully this is relatively straight-forward. The client ActionScript class simply implements flash.utils.IExternalizable. This API requires two methods readExternal() and writeExternal() which take flash.utils.IDataInput and flash.utils.IDataOutput streams respectively. The implementations of these methods mirror the server Java class, which implements – also with two methods readExternal() and writeExternal() taking and streams respectively.

While the IDataInput and IDataOutput classes let you design your own protocol and write fundamental data types such as byte, int, and UTF-8 encoded Strings, most implementations will take advantage of the readObject() and writeObject() methods respectively as these use AMF 3 to efficiently deserialize and serialize ActionScript objects. (Remember that AMF 3 allows: (a) objects to be sent by reference to avoid redundant instances from being serialized, to retain object relationships and to handle cyclical references, (b) object traits to be sent so that the description of a type is only sent once rather than them repeated for each instance, and (c) reoccuring strings can be sent by reference to again avoid redundant information from being sent). One may even decide to omit property names altogether in their externalizable classes’ custom serialization code and rely on a fixed order to send just the property values.

To see a code example, check out While this example focuses on serializing read-only properties there may be many other usages for custom serialization such as omitting properties, avoiding redundant serialization of information or including properties from custom namespaces.

Continue reading…