]> git.basschouten.com Git - openhab-addons.git/commitdiff
[tr064] Use createHttpClient (#14476)
authorlolodomo <lg.hc@free.fr>
Wed, 22 Feb 2023 16:29:03 +0000 (17:29 +0100)
committerGitHub <noreply@github.com>
Wed, 22 Feb 2023 16:29:03 +0000 (17:29 +0100)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.tr064/src/main/java/org/openhab/binding/tr064/internal/Tr064HandlerFactory.java

index 2d23cde6890c0e74364e11d2771b10fba067a6a0..cfddb8f9bd4904e5ca75ec76cbace41a5356796b 100644 (file)
@@ -12,7 +12,7 @@
  */
 package org.openhab.binding.tr064.internal;
 
-import static org.openhab.binding.tr064.internal.Tr064BindingConstants.THING_TYPE_FRITZBOX;
+import static org.openhab.binding.tr064.internal.Tr064BindingConstants.*;
 
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -23,6 +23,7 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.jetty.client.HttpClient;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.openhab.binding.tr064.internal.phonebook.PhonebookProfileFactory;
+import org.openhab.core.io.net.http.HttpClientFactory;
 import org.openhab.core.thing.Bridge;
 import org.openhab.core.thing.Thing;
 import org.openhab.core.thing.ThingTypeUID;
@@ -61,11 +62,12 @@ public class Tr064HandlerFactory extends BaseThingHandlerFactory {
 
     @Activate
     public Tr064HandlerFactory(@Reference Tr064ChannelTypeProvider channelTypeProvider,
-            @Reference PhonebookProfileFactory phonebookProfileFactory) {
+            @Reference PhonebookProfileFactory phonebookProfileFactory,
+            final @Reference HttpClientFactory httpClientFactory) {
         this.channelTypeProvider = channelTypeProvider;
         this.phonebookProfileFactory = phonebookProfileFactory;
         // use an insecure client (i.e. without verifying the certificate)
-        this.httpClient = new HttpClient(new SslContextFactory.Client(true));
+        this.httpClient = httpClientFactory.createHttpClient(BINDING_ID, new SslContextFactory.Client(true));
         try {
             this.httpClient.start();
         } catch (Exception e) {