ozhera-webhook/ozhera-webhook-server/src/main/java/org/apache/ozhera/webhook/common/HttpClientUtil.java [155:188]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static String sendPostRequest(String url, String body, Map<String, String> headers) {
        CloseableHttpClient client = getInstance().getHttpClient();
        try {
            RequestBuilder requestBuilder = RequestBuilder.post(url);
            if (headers != null) {
                for (String headerKey : headers.keySet()) {
                    requestBuilder.setHeader(headerKey, headers.get(headerKey));
                }
            }
            requestBuilder.setConfig(HttpClientUtil.getInstance().getRequestConfig());
            if (StringUtils.isNotEmpty(body)) {
                StringEntity entity = new StringEntity(body, Charset.forName("UTF-8"));
                requestBuilder.setEntity(entity);
            }
            HttpUriRequest httpUriRequest = requestBuilder.build();
            String responseBody = null;
            CloseableHttpResponse response = null;
            try {
                response = client.execute(httpUriRequest);
                responseBody = EntityUtils.toString(response.getEntity(), "utf-8");
                log.info("response body : " + responseBody);
                return responseBody;
            } catch (Exception e) {
                log.error(e.getMessage() + ":" + url);
            } finally {
                if (response != null) {
                    response.close();
                }
            }
        } catch (Exception e) {
            log.error("Failed to call post : url : " + url + " body : " + body, e);
        }
        return null;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



ozhera-operator/ozhera-operator-common/src/main/java/org/apache/ozhera/operator/common/HttpClientUtil.java [151:184]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	public static String sendPostRequest(String url, String body, Map<String, String> headers) {
		CloseableHttpClient client = getInstance().getHttpClient();
		try {
			RequestBuilder requestBuilder = RequestBuilder.post(url);
			if (headers != null) {
				for (String headerKey : headers.keySet()) {
					requestBuilder.setHeader(headerKey, headers.get(headerKey));
				}
			}
			requestBuilder.setConfig(HttpClientUtil.getInstance().getRequestConfig());
			if (StringUtils.isNotEmpty(body)) {
				StringEntity entity = new StringEntity(body, Charset.forName("UTF-8"));
				requestBuilder.setEntity(entity);
			}
			HttpUriRequest httpUriRequest = requestBuilder.build();
			String responseBody = null;
			CloseableHttpResponse response = null;
			try {
				response = client.execute(httpUriRequest);
				responseBody = EntityUtils.toString(response.getEntity(), "utf-8");
				log.info("response body : " + responseBody);
				return responseBody;
			} catch (Exception e) {
				log.error(e.getMessage() + ":" + url);
			} finally {
				if (response != null) {
					response.close();
				}
			}
		} catch (Exception e) {
			log.error("Failed to call post : url : " + url + " body : " + body, e);
		}
		return null;
	}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



