- private DcaeConfigurations getDcaeConfigurations() throws CorrelationException {
- String serviceAddrInfo = MicroServiceConfig.getServiceAddrInfoFromCBS(hostname);
- String response = getDcaeResponse(serviceAddrInfo);
- DcaeConfigurations dcaeConfigurations = null;
- dcaeConfigurations = DcaeConfigurationParser.parse(response);
- return dcaeConfigurations;
- }
-
- private String getDcaeResponse(String serviceAddrInfo) {
- Client client = ClientBuilder.newClient(new ClientConfig());
- WebTarget webTarget = client.target(serviceAddrInfo);
- return webTarget.request("application/json").get()
- .readEntity(String.class);
- }
-
- private RuleQueryListResponse getAllCorrelationRules() {
- Client client = ClientBuilder.newClient(new ClientConfig());
- WebTarget webTarget = client.target(url);
- return webTarget.request("application/json").get()
- .readEntity(RuleQueryListResponse.class);
+ public RuleQueryListResponse getAllCorrelationRules() throws CorrelationException, IOException {
+ HashMap<String, String> headers = new HashMap<>();
+ headers.put("Content-Type", MediaType.APPLICATION_JSON);
+ HttpResponse httpResponse = HttpsUtils.get(url, headers);
+ String response = HttpsUtils.extractResponseEntity(httpResponse);
+ return JSON.parseObject(response,RuleQueryListResponse.class);