]> git.basschouten.com Git - openhab-addons.git/commitdiff
[http] Use createHttpClient (#14480)
authorlolodomo <lg.hc@free.fr>
Wed, 22 Feb 2023 19:37:53 +0000 (20:37 +0100)
committerGitHub <noreply@github.com>
Wed, 22 Feb 2023 19:37:53 +0000 (20:37 +0100)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBindingConstants.java
bundles/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpHandlerFactory.java

index a499eb953a48da8351560c5328aba8490d03e2d3..79ed4b87ee05a014cc49af5c5b6a50378c95d717 100644 (file)
@@ -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");
 }
index 0b864da97a8ea21c7ef345fdf90e9ac91512f152..617e21c4d72d0b01ea36210e8e5cd665e11f43aa 100644 (file)
@@ -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();