2010-06-07 34 views
0

我正在使用BlazeDs。相對上下文根來回Flash應用程序

在services-config.xml中我們得到了以下endPoint的配置。

<channel-definition id="any-amf" class="mx.messaging.channels.AMFChannel"> 
    <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> 
</channel-definition> 

編譯Flash應用程序之前,我將context-root設置爲compilaction選項。

bin\mxmlc -context-root/-services "flex/services-config.xml" -optimize=true -o ..\..\bin\Messenger.swf Messenger.as 

在我而言,這是「/」

而問題是,messanger.swf能夠拉入請求,如果Web應用程序被啓動,如Tomcat的webapps ROOT。 我的意思是它只能通過這個URL localhost:8080 /訪問。如果我嘗試將webaplication移動到另一個文件夾 - 例如localhost:8080/myApplication messenger.swf將無法正常工作sinse我也必須更改root_context。

所以我的問題如何dinamicly確定上下文根在運行時,沒有硬編碼它作爲編譯器的選項? 我希望我的.war應用程序正常工作,無論它在webapps文件夾(url)中的位置如何。

謝謝

回答

0

在這種情況下,我建議設置你的渠道的終點在運行時 - 程序執行過程中不能更改上下文根變量。

相關問題