mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Add a method to retrieve the reporting host
This commit is contained in:
parent
a2fad630c7
commit
2e66e78d7d
@ -25,11 +25,16 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.protocol.HTTP;
|
import org.apache.http.protocol.HTTP;
|
||||||
import org.wso2.carbon.device.mgt.common.exceptions.EventPublishingException;
|
import org.wso2.carbon.device.mgt.common.exceptions.EventPublishingException;
|
||||||
|
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class HttpReportingUtil {
|
public class HttpReportingUtil {
|
||||||
|
|
||||||
|
public static String getReportingHost() {
|
||||||
|
return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST);
|
||||||
|
}
|
||||||
|
|
||||||
public static int invokeApi(String payload, String endpoint) throws EventPublishingException {
|
public static int invokeApi(String payload, String endpoint) throws EventPublishingException {
|
||||||
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
try (CloseableHttpClient client = HttpClients.createDefault()) {
|
||||||
HttpPost apiEndpoint = new HttpPost(endpoint);
|
HttpPost apiEndpoint = new HttpPost(endpoint);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user