Add a method to retrieve the reporting host

feature/appm-store/pbac
Saad Sahibjan 5 years ago committed by inoshperera
parent 30da5afdab
commit 3a7ea53c3a

@ -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…
Cancel
Save