【发布时间】:2013-05-03 16:35:03
【问题描述】:
我在我的项目中使用Apache Felix HTTP Service Jetty 2.2.0。在documentation的基础上,我写了如下代码来更改默认服务端口。
ConfigurationAdmin configAdmin = // get ConfigurationAdmin from OSGi service registry
Configuration config = configAdmin.getConfiguration("org.apache.felix.http" , null);
Dictionary<String, Object> props = config.getProperties();
if(props == null)
{
props = new Hashtable<String, Object>();
}
props.put("org.osgi.service.http.port", newport);
config.update(props);
如您所见,我获取了配置对象,更新了属性并调用了更新方法。所有这些工作正常,但 HttpService 出于某种原因没有选择新配置。我究竟做错了什么?之间我可以使用系统属性方法更改端口。但我希望能够使用ConfigurationAdmin 来做到这一点。
我正在运行Equinox 3.8 容器
【问题讨论】:
标签: java osgi apache-felix