From 232d3efb20f87f9c60faeda7bae4bc96e5687bd3 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期三, 11 十月 2023 19:19:47 +0800 Subject: [PATCH] 10.12 --- cloud-server-account/src/main/java/com/dsh/account/util/httpClinet/HttpClientUtil.java | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/util/httpClinet/HttpClientUtil.java b/cloud-server-account/src/main/java/com/dsh/account/util/httpClinet/HttpClientUtil.java index 78738b7..dc08906 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/util/httpClinet/HttpClientUtil.java +++ b/cloud-server-account/src/main/java/com/dsh/account/util/httpClinet/HttpClientUtil.java @@ -75,7 +75,7 @@ * @param url 请求地址 * @param params 请求参数 */ - private static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ + public static CloseableHttpResponse setPostHttpRequset(String url, Map<String, Object> params, Map<String, String> header, String contentType) throws Exception{ HttpPost httpPost = new HttpPost(url); httpPost.setConfig(getRequestConfig()); if(null != header){ @@ -197,14 +197,14 @@ * @return * @throws Exception */ - public String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ + public static String pushHttpsRequsetXml(String url, String xml, Map<String, String> header, String certPassword, String certPath, String certType) throws Exception{ HttpPost httpPost = new HttpPost(url); for(String key : header.keySet()){ httpPost.setHeader(key, header.get(key)); } httpPost.setHeader("Content-Type", "application/xml"); httpPost.setEntity(new StringEntity(xml, "UTF-8")); - CloseableHttpClient httpCline = this.initCert(certPassword, certPath, certType); + CloseableHttpClient httpCline = initCert(certPassword, certPath, certType); CloseableHttpResponse httpResponse = httpCline.execute(httpPost); String content = null; if(httpResponse.getStatusLine().getStatusCode() == 200){ @@ -212,7 +212,7 @@ }else{ content = "返回状态码:" + httpResponse.getStatusLine() + "。" + EntityUtils.toString(httpResponse.getEntity()); } - this.close(httpResponse); + close(httpResponse); httpCline.close(); return content; } @@ -225,7 +225,7 @@ * @param certType 证书类型 * @throws Exception */ - private CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { + private static CloseableHttpClient initCert(String key, String certPath, String certType) throws Exception { KeyStore keyStore = KeyStore.getInstance(certType); InputStream inputStream = new FileInputStream(new File(certPath)); try { -- Gitblit v1.7.1