public static JsonObject requestWebService(String url,
            Map<String, String> inParamMap) throws Exception {
        if (url == null) {
            throw new Exception("Web service url is null!");
        }
        if (url.trim().toLowerCase().startsWith("https://")) {
            throw new Exception("Unsupported https protocol!");
        }
        // process business parameters
        ArrayList<BasicNameValuePair> params = new ArrayList<>();
        if (inParamMap != null && !inParamMap.isEmpty()) {
            for (Map.Entry<String, String> entry : inParamMap.entrySet()) {
                params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
            }
            if (inParamMap.containsKey(WebFieldDef.CALLERIP.shortName)
                    || inParamMap.containsKey(WebFieldDef.CALLERIP.name)) {
                params.add(new BasicNameValuePair(WebFieldDef.CALLERIP.name,
                        AddressUtils.getIPV4LocalAddress()));
            }
        }
        // build connect configure
        RequestConfig requestConfig = RequestConfig.custom()
                .setConnectTimeout(50000).setSocketTimeout(60000).build();
        // build HttpClient and HttpPost objects
        CloseableHttpClient httpclient = null;
        HttpPost httpPost1 = null;
        HttpPost httpPost2 = null;
        JsonObject jsonRes = null;
        try {
            httpclient = HttpClients.custom()
                    .setDefaultRequestConfig(requestConfig).build();
            UrlEncodedFormEntity se = new UrlEncodedFormEntity(params);
            // build first post request
            httpPost1 = new HttpPost(url);
            httpPost1.setEntity(se);
            // send http request and process response
            CloseableHttpResponse response = httpclient.execute(httpPost1);
            // Determine and process the redirect request
            if (response.getStatusLine().getStatusCode() == 302) {
                String redirectURL = response.getFirstHeader("Location").getValue();
                // build 2td post request
                httpPost2 = new HttpPost(redirectURL);
                httpPost2.setEntity(se);
                response = httpclient.execute(httpPost2);
            }
            // process result
            String returnStr = EntityUtils.toString(response.getEntity());
            if (TStringUtils.isNotBlank(returnStr)
                    && response.getStatusLine().getStatusCode() == 200) {
                jsonRes = JsonParser.parseString(returnStr).getAsJsonObject();
            }
        } catch (Throwable e) {
            throw new Exception("Connecting " + url + " throw an error!", e);
        } finally {
            if (httpPost1 != null) {
                httpPost1.releaseConnection();
            }
            if (httpPost2 != null) {
                httpPost2.releaseConnection();
            }
            if (httpclient != null) {
                try {
                    httpclient.close();
                } catch (IOException ie) {
                    logger.error("Close HttpClient error.", ie);
                }
            }
        }
        return jsonRes;
    }
Send request to target server.

@param url            the target url
@param inParamMap     the parameter map
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/common/utils/HttpUtils.java