| By Victor Rasputnis | Article Rating: |
|
| January 9, 2010 03:00 PM EST | Reads: |
1,376 |
I'd like to use this opportunity and invite Flex developers living in Europe to attend our Advanced Flex Master Class in Brussels, Belgium on March 1 and 2, 2010.
In my previous post I pointed to the BlazeDS classes that need to be replaced in order to prevent ActionScript Number.NaN from turning into Long or Integer zeroes on the MessageBroker side.
The recommendation boiled down to re-jaring flex-messaging-core.jar or placing the modified classes somewhere earlier in the application server's classpath.
If neither option is allowed, you may configure your endpoint with the custom type marshaller, like the one below:
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint">
</endpoint>
<properties>
<serialization>
<type-marshaller>com.farata.messaging.io.CustomTypeMarshaller</type-marshaller>
</serialization>
</properties>
</channel-definition>
In BlazeDS 4 you will base your type marshaller on flex.messaging.io.ASTranslator, in BlazeDS 3 they already have one level of extension called Java15TypeMarshaller, so build on top of that one:
package com.farata.messaging.io;
import com.farata.messaging.io.amf.translator.decoder.NumberDecoder;
import flex.messaging.io.amf.translator.decoder.DecoderFactory;
// For BlazeDS 4 you should extend flex.messaging.io.ASTranslator
public class CustomTypeMarshaller extends
flex.messaging.io.Java15TypeMarshaller {
private static final NumberDecoder numberDecoder = new NumberDecoder();
public Object convert(Object source, Class desiredClass) {
if ( DecoderFactory.isNumber(desiredClass)){
return numberDecoder.decodeObject(source, desiredClass);
}else{
return super.convert(source, desiredClass);
}
}
}
This route does not require neither server-level deployment nor modification of the flex-messaging-core.jar.
Please note that in my example I repackaged NumberDecoder as <strong>com.farata</strong>.messaging.io.amf.translator.decoder.NumberDecoder
I'd like to use this opportunity and invite Flex developers living in Europe to attend our Advanced Flex Master Class in Brussels, Belgium on March 1 and 2, 2010.
Published January 9, 2010 Reads 1,376
Copyright © 2010 Ulitzer, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Victor Rasputnis
Dr. Victor Rasputnis is a Managing Principal of Farata Systems. He's responsible for providing architectural design, implementation management and mentoring to companies migrating to XML Internet technologies. He holds a PhD in computer science from the Moscow Institute of Robotics. You can reach him at vrasputnis@faratasystems.com
- Jobs Has a Few Words for Google & Adobe & They Ain’t Pretty: Reports
- Can You Fire a Team?
- UPDATE: Adobe & IE Implicated as China’s Spy Holes
- Adobe Flash on the Road to Nowhere
- Cenzic Web Application Security Trends Report Reveals 90 Percent of Web Applications Vulnerable, Adobe One of the Most Vulnerable
- Systems Alliance Releases Enhancement Pack 7 (EP7) for SiteExecutive™ Web Content Management System
- PaaS vs. Managed Virtualization
- New Partners Join Growing Web Solutions Firm
- Open Source Alternatives to LiveCycle Data Services
- Netsmart Announces 'My Avatar' at National Council for Community Behavioral Healthcare Annual Conference
- Jobs Has a Few Words for Google & Adobe & They Ain’t Pretty: Reports
- Can You Fire a Team?
- How to Secure REST and JSON
- UPDATE: Adobe & IE Implicated as China’s Spy Holes
- Adobe Flash on the Road to Nowhere
- Apple Tries Pissing on Google’s Shoes
- The Roadmap for Adobe LCDS 3
- How to Prevent Flex Numeric Nulls From Turning to Zeros in BlazeDS
- Adobe to Discusses Social Media and Government
- Using Custom Type Marshallers in BlazeDS
- Adobe Update: "Unambiguous Statement" Coming
- Master Class on Adobe Flex in Brussels and More
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- AJAXWorld University Announces AJAX Developer Bootcamp
- The Next Programming Models, RIAs and Composite Applications
- SYS-CON Media Readers Cast More Than 4,000 Votes In First Week Of Voting
- SYS-CON Media Opens Its Eighth Annual "Readers' Choice Awards" Polls
- SYS-CON Media Readers' Choice Awards Polls Will Close on December 31, 2005
- Constructing an Application with Flash Forms from the Ground Up
- Your First Adobe Flex Application with a ColdFusion Backend
- SOA Web Services Edge Conference Coverage on SYS-CON.TV
- AJAX: Making the HTML User Experience Almost As Pleasant as Flash























Ulitzer content is offered under Creative Commons "Attribution Non-Commercial No Derivatives" License.
For any reuse or distribution, you must make clear to others the license terms of this work.
The best way to do this is with a link to this web page.
Any of the above conditions can be waived if you get written permission from Ulitzer, Inc., the copyright holder.
Nothing in this license impairs or restricts the author's moral rights.