Flex和Java 整合有幾種方法,最常見的是:
一,F(xiàn)lex,java在一個項目中。
二,F(xiàn)lex,java分別在兩個項目中。
第一種,直接在新建Flex項目中選擇應(yīng)用服務(wù)器,選擇blazeDS即可。
注意要寫上輸出文件夾url.endpoint="messagebroker/amf" 寫上相對路徑即可。
第二種,分別新建Flex ,java 項目,blazeds.war項目中的WebConten/Web-Inf替代java項目下的web-inf。在remoting-config.xml下寫上:
<destination id="hxh">
<properties>
<source>com.demo.hxh</source>
</properties>
</destination>
并布署為tomcat.
Flex項目中修改endpoint="/hxh/messagebroker/amf",并設(shè)置輸出文件夾為java ,WebContent下的,輸出文件夾url為java項目,如為http://localhost:8400/hxh
或者新建項目如一,在新建項目java把編譯目錄設(shè)為Flex-webcontent-classes下。
一般問題都錯在設(shè)置上,endpoint是一個注意點。
關(guān)于endpoint:
public interface Endpointextends ManageableAn 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參數(shù):
1) 全路徑: endpoint="http://server:8080/HelloBlazeDS/messagebroker/amf" >
2) 基于contextRoot: endpoint="/HelloBlazeDS/messagebroker/amf" >
3) 基于當(dāng)前路徑: endpoint="messagebroker/amf" >
本文來自CSDN博客,轉(zhuǎn)載請標(biāo)明出處:http://blog.csdn.net/bill1315/archive/2010/07/21/5751496.aspx