纯as3项目中 无法映射java List的解决方法

纯AS3项目中 使用blazeds与java后端通信的时候 java.util.List无法转换成as3 Array

在Flex项目中我们可以使用as ArrayCollection 来映射java.util.Collection 而纯的as3项目中没有使用到flex的包所以是没有ArrayCollection这个类的

为了解决这个问题我需要在blazeds的配置文件service-config.xml文件的<channel-definition>子节点中加入如下配置

<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" />
			<properties>
				<polling-enabled>false</polling-enabled>
				<serialization><legacy-collection>true</legacy-collection></serialization>//该行就是需要加入的配置
			</properties>
		</channel-definition>

 legacy-collection默认为false 此时序列化的java.util.collection会转换成as ArrayCollection

设置为true时就可以成功转换成as Array了

你可能感兴趣的:(java,xml,Flex)