Flex和Java 整合


Flex和Java 整合有几种方法,最常见的是:

一,Flex,java在一个项目中。

二,Flex,java分别在两个项目中。

第一种,直接在新建Flex项目中选择应用服务器,选择blazeDS即可。

注意要写上输出文件夹url.endpoint="messagebroker/amf" 写上相对路径即可。

第二种,分别新建Flex ,java 项目,blazeds.war项目中的WebConten/Web-Inf替代java项目下的web-inf。在remoting-config.xml下写上:

  • <destinationid="hxh">
  • <properties>
  • <source>com.demo.hxh</source>
  • </properties>
  • </destination>

并布署为tomcat.

Flex项目中修改endpoint="/hxh/messagebroker/amf",并设置输出文件夹为java ,WebContent下的,输出文件夹url为java项目,如为http://localhost:8400/hxh

或者新建项目如一,在新建项目java把编译目录设为Flex-webcontent-classes下。

一般问题都错在设置上,endpoint是一个注意点。

关于endpoint:

public interface Endpoint
extends Manageable

An endpoint receives messages from clients and decodes them, then sends them on to a MessageBroker for routing to a service. The endpoint also encodes messages and delivers them to clients. Endpoints are specific to a message format and network transport, and are defined by the named URI path on which they are located.

在 <mx:RemoteObject/> 对象中指定Endpoint参数:

1) 全路径: endpoint="http://server:8080/HelloBlazeDS/messagebroker/amf" >
2) 基于contextRoot: endpoint="/HelloBlazeDS/messagebroker/amf" >
3) 基于当前路径: endpoint="messagebroker/amf" >

你可能感兴趣的:(java,tomcat,应用服务器,Web,Flex)