简化 services-config.xml 中的 Flex 部署?

发布于 2024-08-19 15:58:11 字数 713 浏览 1 评论 0原文

我正在使用 Flex/Flash 构建一个 UI,它是我的 Rails 服务器应用程序的前端。我使用 WebORB 作为通信机制。然而,我的问题应该不仅仅适用于 WebORB。 (我认为)。

具体来说,它与 services-config.xml 文件有关。我有一个本地(笔记本电脑)开发环境、一个远程开发环境和一个远程生产环境。我厌倦了在 services-config.xml 文件中编辑 URL、每次想要在不同环境中测试时重新构建和部署。

有人对如何做到这一点有任何想法吗?我想我可以执行以下操作:

   <channel-definition id="supremacy" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="/weborb" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
        </properties>
    </channel-definition>

通过设置 URI="/weborb" 并给它一个相对路径,我认为它会起作用。它在本地确实如此,但当我将其部署到远程开发和生产环境(Heroku)时却不然。诡异的。

I am using Flex/Flash to build a UI which front-ends my Rails server application. I am using WebORB as the communication mechanism. My question should apply beyond just WebORB, however. (I think).

Specifically, it has to do with the services-config.xml file. I have a local (laptop) dev environment, a remote dev and a remote production environment. I am sick of editing the URL in the services-config.xml file, rebuilding and deploying every time I want to test in a different environment.

Does anyone have any ideas on how to do this? I thought I could do the following:

   <channel-definition id="supremacy" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="/weborb" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
        </properties>
    </channel-definition>

By setting the URI="/weborb" and giving it a relative path, I figured it would work. And it does--locally--but it doesn't when I deploy it to my remote dev and prod environments (Heroku). Weird.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若无相欠,怎会相见 2024-08-26 15:58:11

您可以通过使用 Ant 构建项目来稍微简化该过程。例如,您可以为每个环境创建单独的 services-config.xml 文件,然后为不同的环境编译单独的构建脚本,自动选择适当的配置文件。

You could simplify the process somewhat by building your project with Ant. For example, you could create separate services-config.xml files for each environment and then have separate build scripts to compile for the different environments, choosing the appropriate config file automatically.

不美如何 2024-08-26 15:58:11

您可以在应用程序启动时配置您的服务(因此基于配置文件)

使用 amfEndpoint 作为字符串创建一个通道

var ChannelSet : ChannelSet = new ChannelSet();

var 通道:NetConnectionChannel = null;

channel = new AMFChannel("my-amf", amfEndpoint );

channelSet.addChannel( 通道 );

把它交给你的远程对象

ServiceLocator.getInstance().getRemoteObject( "myService" ).channelSet = channelSet;

You could configure your service on application startup (so based on a config file)

Create a channel with amfEndpoint as a string

var channelSet : ChannelSet = new ChannelSet();

var channel : NetConnectionChannel = null;

channel = new AMFChannel( "my-amf", amfEndpoint );

channelSet.addChannel( channel );

Give it to your remote object

ServiceLocator.getInstance().getRemoteObject( "myService" ).channelSet = channelSet;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文