开发者

Relative context-root fro flash application

i' m using BlazeDs.

In services-config.xml we got following configuration of 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>

Before compiling flash a开发者_StackOverflow社区pplication i set up context-root as compilaction option.

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

In my case this is "/"

And the problem is that messanger.swf is able to pull request if the web application is started as ROOT in tomcat webapps. I mean it can only be access by this url localhost:8080/. If i try to move webaplication to another folder - for example to localhost:8080/myApplication messenger.swf would not work properly sinse i have to change root_context as well.

So my question how to dinamicly determine context-root in run time, without hardcode it as option of compiler ? I want my .war application work properly regardless of it position in webapps folder(url).

Thank you


In this case I suggest to set the endpoint of your channels at runtime - you cannot change context-root variable during program execution.


Use something like HTTPUtil.as from "Flex Pasta" to get the application URL at runtime and use the functions (getHostName, getContext, getPort) to calculate your servlet URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜