I am using Apache Felix HTTP Service Jetty 2.2.0 in my project. Based on the documentation I wrote the following code to change the default service port.
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);
As you can see I get the configuration object, update properties and call the update method.All this works fine but HttpService
for some reason doesn't pick up the new configuration. What am I doing wrong? Between I am able to change the port by using the System property approach. But I want to be able to use ConfigurationAdmin
to do it.
I am running Equinox 3.8
container