[http] Use createHttpClient (#14480)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
@@ -24,7 +24,7 @@ import org.openhab.core.thing.ThingTypeUID;
|
|||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
public class HttpBindingConstants {
|
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");
|
public static final ThingTypeUID THING_TYPE_URL = new ThingTypeUID(BINDING_ID, "url");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.openhab.binding.http.internal;
|
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;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -59,8 +59,9 @@ public class HttpHandlerFactory extends BaseThingHandlerFactory
|
|||||||
@Activate
|
@Activate
|
||||||
public HttpHandlerFactory(@Reference HttpClientFactory httpClientFactory,
|
public HttpHandlerFactory(@Reference HttpClientFactory httpClientFactory,
|
||||||
@Reference HttpDynamicStateDescriptionProvider httpDynamicStateDescriptionProvider) {
|
@Reference HttpDynamicStateDescriptionProvider httpDynamicStateDescriptionProvider) {
|
||||||
this.secureClient = new HttpClient(new SslContextFactory.Client());
|
this.secureClient = httpClientFactory.createHttpClient(BINDING_ID + "-secure", new SslContextFactory.Client());
|
||||||
this.insecureClient = new HttpClient(new SslContextFactory.Client(true));
|
this.insecureClient = httpClientFactory.createHttpClient(BINDING_ID + "-insecure",
|
||||||
|
new SslContextFactory.Client(true));
|
||||||
try {
|
try {
|
||||||
this.secureClient.start();
|
this.secureClient.start();
|
||||||
this.insecureClient.start();
|
this.insecureClient.start();
|
||||||
|
|||||||
Reference in New Issue
Block a user