From 20ac69725a39d8c47dc2bc72357c949f6571d6ca Mon Sep 17 00:00:00 2001 From: lolodomo Date: Wed, 22 Feb 2023 20:37:53 +0100 Subject: [PATCH] [http] Use createHttpClient (#14480) Signed-off-by: Laurent Garnier --- .../binding/http/internal/HttpBindingConstants.java | 2 +- .../openhab/binding/http/internal/HttpHandlerFactory.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBindingConstants.java b/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBindingConstants.java index a499eb953..79ed4b87e 100644 --- a/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBindingConstants.java +++ b/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBindingConstants.java @@ -24,7 +24,7 @@ import org.openhab.core.thing.ThingTypeUID; @NonNullByDefault public class HttpBindingConstants { - private static final String BINDING_ID = "http"; + public static final String BINDING_ID = "http"; public static final ThingTypeUID THING_TYPE_URL = new ThingTypeUID(BINDING_ID, "url"); } diff --git a/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpHandlerFactory.java b/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpHandlerFactory.java index 0b864da97..617e21c4d 100644 --- a/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpHandlerFactory.java +++ b/bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpHandlerFactory.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.http.internal; -import static org.openhab.binding.http.internal.HttpBindingConstants.THING_TYPE_URL; +import static org.openhab.binding.http.internal.HttpBindingConstants.*; import java.util.Set; @@ -59,8 +59,9 @@ public class HttpHandlerFactory extends BaseThingHandlerFactory @Activate public HttpHandlerFactory(@Reference HttpClientFactory httpClientFactory, @Reference HttpDynamicStateDescriptionProvider httpDynamicStateDescriptionProvider) { - this.secureClient = new HttpClient(new SslContextFactory.Client()); - this.insecureClient = new HttpClient(new SslContextFactory.Client(true)); + this.secureClient = httpClientFactory.createHttpClient(BINDING_ID + "-secure", new SslContextFactory.Client()); + this.insecureClient = httpClientFactory.createHttpClient(BINDING_ID + "-insecure", + new SslContextFactory.Client(true)); try { this.secureClient.start(); this.insecureClient.start();