private static String doHttpQuery(URL url, String requestMethod, String payload, String contentType)
throws IOException {
+ LoggingUtils utils = new LoggingUtils (logger);
logger.info("Using HTTP URL to contact DCAE:" + url);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection = utils.invoke(connection,"DCAE", requestMethod);
connection.setRequestMethod(requestMethod);
connection.setRequestProperty("X-ECOMP-RequestID", LoggingUtils.getRequestId());
if (payload != null && contentType != null) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String responseStr = IOUtils.toString(reader);
logger.info("Response Content: " + responseStr);
+ utils.invokeReturn();
return responseStr;
}
} else {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getErrorStream()))) {
String responseStr = IOUtils.toString(reader);
logger.error(DCAE_REQUEST_FAILED_LOG + responseStr);
+ utils.invokeReturn();
throw new BadRequestException(responseStr);
}
}