IBM Worklight - 如何在启动或运行时动态更改适配器从客户端连接到的域/主机名? [英] IBM Worklight - How to change dynamically domain/hostname to which the adapter connects from the client at launch or runtime?

查看:90
本文介绍了IBM Worklight - 如何在启动或运行时动态更改适配器从客户端连接到的域/主机名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

配置WL HTTP适配器时,域和端口是适配器配置.xml文件构建的一部分,并在WL服务器上上载。
对于我们的用例(尤其是beta测试和演示),端点服务器url需要为最终用户配置。例如,相同的版本在测试环境中由QA测试,而BA连接到演示。
我们只有一个WL服务器,并且不能选择设置特定于环境的服务器。

When configuring WL HTTP Adapters, the domain and port are part of the adapter configuration .xml file build and uploaded on the WL server. For our use case (especially beta testing and demos) the endpoint server url needs to be configurable for the end user. Example, same builds are tested by QA on test envs, while BA connects to demo. We have only one WL Server up and setting environment specific servers is not an option.

是否可以在应用程序启动或运行时动态更改域/主机名?理想情况下,从客户端获取并使用来自下拉列表或免费输入的域/主机名值并使用它。

Is it possible to change domain/hostname dynamically at application launch or runtime ? Ideally it would be to get and use the domain/hostname value from a drop down or free input from the client and use it.

<connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>http</protocol>
            <domain>{hostname}</domain>
            <port>80</port>         
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>


推荐答案

更新:这个答案是有用的,所以我把它留在这里作为参考,但接受它没有正确回答这个的问题!

Update: This answer is useful, so I leave it here for reference, but accept that it doesn't correctly answer this question!

有一个特定的Worklight功能旨在解决您的方案(对于信息中心的详细信息,请看这里)。

There is a specific Worklight feature designed to address your scenario (for the Infocenter detail, see here).

您可以使用<$ c $的组合来完成此操作c> worklight.properties 和JNDI属性。

You can do this by using a combination of worklight.properties and JNDI properties.

例如,假设您在适配器XML中进行了此设置:

For example, let's say you had this setup in your adapter XML:

 <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>${my.adapter.protocol}</protocol>
            <domain>${my.adapter.domain}</domain>
            <port>${my.adapter.port}</port>         
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
 </connectivity>

然后在 worklight.properties 文件(在Worklight项目的 server / conf 目录中,并烧入到 .WAR 构建时的文件):

You then define default values for these in your worklight.properties file (in the server/conf directory of your Worklight project, and "burnt in" to the .WAR file when you build it):

my.adapter.protocol=http
my.adapter.domain=some.host.com
my.adapter.port=80

然后你可以覆盖这些通过设置JNDI属性,在各个环境中的值。例如,如果您使用的是WebSphere Liberty,则可以将其放在server.xml中:

You can then override these values in individual environments, by setting JNDI properties. For example, if you are using WebSphere Liberty, you might put this in your server.xml:

<jndiEntry jndiName="my.adapter.protocol" value="https"/>
<jndiEntry jndiName="my.adapter.domain" value="some.other.host.com"/>
<jndiEntry jndiName="my.adapter.port" value="8080"/>

这篇关于IBM Worklight - 如何在启动或运行时动态更改适配器从客户端连接到的域/主机名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆