Mantis - Hessian
Viewing Issue Advanced Details
2954 feature always 09-22-08 15:02 10-14-08 18:04
bdespres  
 
normal  
closed 3.2.0  
fixed  
none    
none 3.2.1  
0002954: Add support for AMF-style RemoteClass aliases in hessian-flex
When using AMF serialization in Flex, you can tag your AS class using the RemoteClass metadata tag, which allows you to map (for example) a Java class on the server to a different class in AS. Right now when using Hessian serialization, the Java and ActionScript fully-qualified class names have to match exactly (package + class name). Ideally, I should be able to define an AS class like this:

package com.mycompany {
  [RemoteClass(alias="com.mycompany.Foo")]
  public class Bar {
     ...
  }
}

and have it map to my com.mycompany.Foo class in Java (assuming all the instance variables match up)

It looks like this could be accomplished in Hessian2Input.readObjectInstance() by adding a call "flash.net.getClassByAlias(type)" to look for the Class, then falling back to "flash.utils.getDefinitionByName()" if there's no alias.

Then in HessianOutput.writeObject(object:Object,className:String = null), instead of calling getQualifiedClassName(), call flash.utils.describeType(), and check for an "alias" attribute in the root (type) tag, otherwise use the "name" attribute, which has the fully-qualified class name in it.
See:
http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html#244138 [^]

There are no notes attached to this issue.