felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karel Haeck <karel.ha...@telenet.be>
Subject Re: Using config admin to setup https
Date Wed, 13 Apr 2016 19:11:16 GMT

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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message