Paul,

any reason why you are using a factory configuration ?
replacing   config = configAdmin.createFactoryConfiguration(pid, null);
with config = configAdmin.getConfiguration(pid, null);
should work.

On 13/04/2016 3:38, Paul F Fraser wrote:
Hi,

I have used the code below to try and set up https. Using org.apache.felix.http.jetty version 3.2.0

Webconsole shows I have 2 services running, one containing the default settings for jetty and one containing my setting as per my code.

As a result, Jetty starts up on port 8080.

Presumably the http bundle starts and creates the default version.
How do I replace the default service?

Thanks,

Paul Fraser

@Component
public class JettyConfig {

    @Reference
    ConfigurationAdmin configAdmin;
    private Configuration config;
    private Path keystorePath;

    @Activate
    public void startup(ComponentContext ctx) throws IOException {

        Dictionary<String, Object> props = new Hashtable();

        String pid = "org.apache.felix.http";

        props.put("org.apache.felix.http.enable", false);
        props.put("org.apache.felix.https.enable", true);
        props.put("org.osgi.service.http.port.secure", 8443);
props.put("org.apache.felix.https.keystore", keystorePath.toString());
        props.put("org.apache.felix.https.keystore.password", "keypass");

        config = configAdmin.createFactoryConfiguration(pid, null);
        config.update(props);
    }

    @Deactivate
    public void shutdown() throws IOException {
        config.delete();
    }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to