【发布时间】:2015-06-04 15:26:07
【问题描述】:
我目前正在开发一个 REST Web 服务并在 FELIX 下以捆绑包的形式公开它。我正在为 Web 服务使用 JAX-RS 连接器。 该服务工作正常,但如果我想访问资源模板 URL 是
http://IP:PORT/services/path/to/my/resource
目标是将上下文路径服务更改为通过 URL 访问资源 像 http://IP:PORT/path/to/my/resource
我尝试更改管理员配置,如 JAX-RS 连接器的常见问题解答中所述,但我仍然遇到问题
ServiceReference configurationAdminReference = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());
if(configurationAdminReference != null) {
ConfigurationAdmin confAdmin = (ConfigurationAdmin) bundleContext.getService(configurationAdminReference);
if(confAdmin != null) {
Configuration configConnector = confAdmin.getConfiguration("com.eclipsesource.jaxrs.connector",null);
Dictionary<String, String> props = configConnector.getProperties()
if (props == null) {
Dictionary<String, String> props = new Hashtable<String,String>();
}
props.put("root","/");
configConnector.update(props);
}
}
我已经看到有人在这个论坛上遇到过这个问题,但在我的情况下它并没有解决问题 我可以在 felix web 控制台中看到以下错误消息
错误:PID“com.eclipsesource.jaxrs.connector”绑定到“file:/c:/Dev/Tools/Apache/Felix/bundle/mybundle-1.0.0.jar”,但实际托管服务是从“inputstream:publisher-4.3.jar”包注册
有什么想法吗?
【问题讨论】:
标签: java rest jax-rs apache-felix