public static <T> T request(RestTemplate restTemplate, String url, HttpMethod method,
            String param, HttpHeaders header, Class<T> cls) throws Exception {
        ResponseEntity<String> exchange;
        try {
            HttpEntity<String> request = new HttpEntity<>(param, header);
            log.debug("send request to {}, param {}", url, param);
            exchange = restTemplate.exchange(url, method, request, String.class);
            String body = exchange.getBody();
            HttpStatus statusCode = exchange.getStatusCode();
            if (!statusCode.is2xxSuccessful()) {
                log.error("request error for {}, status code {}, body {}", url, statusCode, body);
            }

            log.debug("response from {}, status code {}", url, statusCode);
            return GSON.fromJson(exchange.getBody(), cls);
        } catch (RestClientException e) {
            log.error("request for {} exception {} ", url, e.getMessage());
            throw e;
        }
    }
Send an HTTP request by the given rest template.
inlong-manager/manager-common/src/main/java/org/apache/inlong/manager/common/util/HttpUtils.java