mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-20 08:51:16 +00:00
Change to Generic HTTPClient
This commit is contained in:
@@ -4,7 +4,7 @@ import static java.lang.String.format;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import com.bwssystems.HABridge.HttpRequestHelper;
|
import com.bwssystems.HABridge.plugins.http.HTTPHandler;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -35,6 +35,7 @@ public class HarmonyServer {
|
|||||||
private OAReplyProvider dummyProvider;
|
private OAReplyProvider dummyProvider;
|
||||||
private NamedIP myNameAndIP;
|
private NamedIP myNameAndIP;
|
||||||
private Boolean isDevMode;
|
private Boolean isDevMode;
|
||||||
|
private HTTPHandler httpClient;
|
||||||
private Logger log = LoggerFactory.getLogger(HarmonyServer.class);
|
private Logger log = LoggerFactory.getLogger(HarmonyServer.class);
|
||||||
|
|
||||||
public HarmonyServer(NamedIP theHarmonyAddress) {
|
public HarmonyServer(NamedIP theHarmonyAddress) {
|
||||||
@@ -43,6 +44,7 @@ public class HarmonyServer {
|
|||||||
dummyProvider = null;
|
dummyProvider = null;
|
||||||
myNameAndIP = theHarmonyAddress;
|
myNameAndIP = theHarmonyAddress;
|
||||||
isDevMode = false;
|
isDevMode = false;
|
||||||
|
httpClient = new HTTPHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HarmonyServer setup(
|
public static HarmonyServer setup(
|
||||||
@@ -96,7 +98,7 @@ public class HarmonyServer {
|
|||||||
log.info(format("calling webhook: %s", webhook));
|
log.info(format("calling webhook: %s", webhook));
|
||||||
|
|
||||||
// Calling webhook
|
// Calling webhook
|
||||||
HttpRequestHelper.INSTANCE.doHttpRequest(webhook, HttpGet.METHOD_NAME, null, null, null);
|
httpClient.doHttpRequest(webhook, HttpGet.METHOD_NAME, null, null, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("could not call webhook: " + webhook, e);
|
log.warn("could not call webhook: " + webhook, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user