| By Victor Rasputnis | Article Rating: |
|
| January 9, 2010 03:00 PM EST | Reads: |
5,776 |
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 5,776
Copyright © 2010 SYS-CON Media, 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
- Asynchronous Logging Using Spring
- What to Expect in 2012: Cloud Computing and Open Source Software
- Will PaaS Finally Bring Open Source Love to the Enterprise?
- AT&T Joins OpenStack, Floats Cloud Architect
- Red Hat Sets Up GlusterFS Advisory Board
- Linux Virtualization and Tired Open Source Myths
- Acquia Announces Two New Board Members
- OpenOffice.com Lives
- Cloud Computing: A Platform-First Approach
- Powering the Cloud with Open Source
- Top 10 Open Source eCommerce Software (Joomla and Drupal)
- Piston Delivers First OpenStack-Based Cloud OS
- Adobe Sends Flex to the Apache Foundation
- i-Technology in 2012: Five Industry Predictions
- Microsoft Tries Hadoop on Azure
- OpenXava 4.3: Rapid Java Web Development
- Asynchronous Logging Using Spring
- StorSimple Supports OpenStack
- What to Expect in 2012: Cloud Computing and Open Source Software
- Will PaaS Finally Bring Open Source Love to the Enterprise?
- AT&T Joins OpenStack, Floats Cloud Architect
- More Use Cases for Big Data Analytics
- Red Hat Sets Up GlusterFS Advisory Board
- Linux Virtualization and Tired Open Source Myths
- After Ubuntu, Windows Looks Increasingly Bad, Increasingly Archaic, Increasingly Unfriendly
- SCO CEO Posts Open Letter to the Open Source Community
- Simula Labs Launches Hosted Delivery Platform To Enable Enterprise Open Source Adoption
- Where Are RIA Technologies Headed in 2008?
- Source Claims SCO Will Sue Google
- How Open Is "Open"? – Industry Luminaries Join the Debate
- Latest SCO News is Plain Weird
- SCO Claims Linux Lifted ELF
- IBM Tells SCO Court It Can't Find AIX-on-Power Code
- Flashback: Investing in 'Professional Open Source' - Exclusive 2004 Interview with David Skok, Matrix Partners
- Developing an Application Using the Eclipse BIRT Report Engine API
- HP Starts Pushing Desktop Linux























