0

プロジェクトでApache Felix HTTP Service Jetty 2.2.0を使用 しています。ドキュメントに基づいて、デフォルトのサービス ポートを変更する次のコードを作成しました。

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);

ご覧のとおり、構成オブジェクトを取得し、プロパティを更新して update メソッドを呼び出します。これはすべて正常に機能しますがHttpService、何らかの理由で新しい構成が取得されません。私は何を間違っていますか?その間に、システム プロパティ アプローチを使用してポートを変更できます。しかし、私ConfigurationAdminはそれを行うために使用できるようにしたい. Equinox 3.8コンテナを実行しています

4

1 に答える 1

0

Felix Http config admin プロパティの代わりに OSGi システム プロパティを使用します。以下に例を示します。

   "service.pid":                              "org.apache.felix.http", 
   "org.apache.felix.http.enable":             true, 
   "org.osgi.service.http.port":               8080,
   "org.apache.felix.http.debug":              true, 
   "org.apache.felix.https.debug":             true, 
   "org.apache.felix.https.enable":            true, 
   "org.osgi.service.http.port.secure":        8085,
   "org.apache.felix.https.keystore":          "@{resource:example.keystore.ks}", 
   "org.apache.felix.https.keystore.password": "@{.example.keystore}",
于 2013-05-03T18:10:09.647 に答える