Hey all,

This is both an FYI and a query to see if anyone has a solution to this
issue.

There seems to be a bug in Flash Remoting in the handling of
java.util.Map keys. 

Setup:

 Flex 1.5
 Remoting configured with 
    <serialization>Flex</serialization>
    <lowercase-keys>false</lowercase-keys>

The issue is that Map keys are always made lowercase. The issue appears
to be in the deserializing of objects of type 'ECMA Array' coming from
Flash.

To reproduce create a Java service:

public class RemotingService
{
  public Map getMap()
  {
     Map map = new HashMap();
     map.put("Uppercase Key", "value");
     return map;
  }

  public Object echo(Object obj)
  {
    return obj;
  }
}

Using these services in Flex to reproduce this bug as follows:

1. Call getMap() to get the map instance from the server
2. trace the map keys - the key will still be mixed case
3. Call echo() with the map as argument
4. trace the returned map keys - the key will be all lowercase

It seems to me that the Map contents should be able to round trip
without modification.

Turning on debugging in the gateway, I you can see that the type of the
map is 'ECMA Array'. There doesn't seem to be a way to create an ECMA
Array in ActionScript. You can only get one back from a Remoting call.

I need my Map key case to be preserved. The only workaround for this
issue I can think of is to clone the Map contents into an ActionScript
object before sending it back to the server:

var clone = {};
for (var p in map)
{
  clone[p] = map[p];
}

This does work - the gateway debugging shows that this is now of type
'Object' which correctly becomes a Map with key case preserved in Java.

Anyone got any better ideas?

Alon
alon at carbonfive.com


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to