- String url = refProp.getStringValue("DCAE_DISPATCHER_URL") + "/dcae-deployments/" + deploymentId;\r
- logger.info("Dcae Dispatcher Service url - " + url);\r
- URL obj = new URL(url);\r
- HttpsURLConnection conn = (HttpsURLConnection) obj.openConnection();\r
- conn.setRequestMethod("PUT");\r
- conn.setRequestProperty("Content-Type", "application/json");\r
- conn.setDoOutput(true);\r
- try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {\r
- wr.writeBytes(apiBodyString);\r
- wr.flush();\r
- }\r
-\r
- boolean requestFailed = true;\r
- int responseCode = conn.getResponseCode();\r
- logger.info("responseCode=" + responseCode);\r
- if (responseCode == 200 || responseCode == 202) {\r
- requestFailed = false;\r
- }\r
-\r
- inStream = conn.getErrorStream();\r
- if (inStream == null) {\r
- inStream = conn.getInputStream();\r
- }\r
-\r
- String responseStr = null;\r
- if (inStream != null) {\r
- in = new BufferedReader(new InputStreamReader(inStream));\r
-\r
- String inputLine = null;\r
-\r
- StringBuffer response = new StringBuffer();\r
-\r
- while ((inputLine = in.readLine()) != null) {\r
- response.append(inputLine);\r
- }\r
-\r
- responseStr = response.toString();\r
- }\r
-\r
- if (responseStr != null) {\r
- if (requestFailed) {\r
- logger.error("requestFailed - responseStr=" + responseStr);\r
- throw new Exception(responseStr);\r
- }\r
- }\r
-\r
- logger.debug("response code " + responseCode);\r