mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[somneo] Use createHttpClient (#14477)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
fbf9a9e6a9
commit
fa7e4e7594
@ -24,7 +24,7 @@ import org.openhab.core.thing.ThingTypeUID;
|
||||
@NonNullByDefault
|
||||
public class SomneoBindingConstants {
|
||||
|
||||
private static final String BINDING_ID = "somneo";
|
||||
public static final String BINDING_ID = "somneo";
|
||||
|
||||
// List of all Thing properties
|
||||
public static final String PROPERTY_VENDOR_NAME = "Philips";
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.somneo.internal;
|
||||
|
||||
import static org.openhab.binding.somneo.internal.SomneoBindingConstants.THING_TYPE_HF367X;
|
||||
import static org.openhab.binding.somneo.internal.SomneoBindingConstants.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -20,6 +20,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.openhab.core.io.net.http.HttpClientFactory;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
||||
@ -50,11 +51,14 @@ public class SomneoHandlerFactory extends BaseThingHandlerFactory implements Htt
|
||||
private final SomneoPresetStateDescriptionProvider provider;
|
||||
|
||||
@Activate
|
||||
public SomneoHandlerFactory(@Reference SomneoPresetStateDescriptionProvider provider) {
|
||||
public SomneoHandlerFactory(final @Reference HttpClientFactory httpClientFactory,
|
||||
@Reference SomneoPresetStateDescriptionProvider provider) {
|
||||
this.provider = provider;
|
||||
|
||||
this.secureClient = new HttpClient(new SslContextFactory.Client(false));
|
||||
this.insecureClient = new HttpClient(new SslContextFactory.Client(true));
|
||||
this.secureClient = httpClientFactory.createHttpClient(BINDING_ID + "-secure",
|
||||
new SslContextFactory.Client(false));
|
||||
this.insecureClient = httpClientFactory.createHttpClient(BINDING_ID + "-insecure",
|
||||
new SslContextFactory.Client(true));
|
||||
|
||||
try {
|
||||
this.secureClient.start();
|
||||
|
Loading…
Reference in New Issue
Block a user