log4j dep exclusion
This commit is contained in:
parent
913dce9225
commit
f928248447
@ -181,6 +181,12 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
6
pom.xml
6
pom.xml
@ -261,6 +261,12 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.ssl.SSLContextBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
@ -36,6 +36,7 @@ import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -50,18 +51,17 @@ public class HttpUtils {
|
||||
*/
|
||||
private static PoolingHttpClientConnectionManager poolConnManager = null;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(HttpUtils.class);
|
||||
|
||||
private static CloseableHttpClient httpClient = null;
|
||||
/**
|
||||
* 请求器的配置
|
||||
*/
|
||||
private static RequestConfig requestConfig;
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger(HttpUtils.class);
|
||||
|
||||
static {
|
||||
try {
|
||||
System.out.println("httpClient~~~开始");
|
||||
logger.info("httpClient init...");
|
||||
SSLContextBuilder builder = new SSLContextBuilder();
|
||||
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
|
||||
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build());
|
||||
@ -84,7 +84,7 @@ public class HttpUtils {
|
||||
connectTimeout).build();
|
||||
// 初始化httpClient
|
||||
httpClient = getConnection();
|
||||
System.out.println("初始化HttpClient~~~结束");
|
||||
System.out.println("HttpClient inited.");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -448,15 +448,16 @@ public class HttpUtils {
|
||||
}
|
||||
connection.connect();
|
||||
//OutputStream out = new DataOutputStream(connection.getOutputStream());
|
||||
PrintWriter out = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), "UTF-8"));
|
||||
out.print(formSB.toString());
|
||||
PrintWriter out = new PrintWriter(new OutputStreamWriter(connection.getOutputStream(), StandardCharsets.UTF_8));
|
||||
out.print(formSB);
|
||||
out.flush();
|
||||
//获得响应状态
|
||||
int resultCode = connection.getResponseCode();
|
||||
if (HttpURLConnection.HTTP_OK == resultCode) {
|
||||
formSB = new StringBuffer();
|
||||
String readLine;
|
||||
BufferedReader responseReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||
BufferedReader responseReader = new BufferedReader(new InputStreamReader(connection.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
while ((readLine = responseReader.readLine()) != null) {
|
||||
formSB.append(readLine).append("\n");
|
||||
}
|
||||
@ -506,7 +507,7 @@ public class HttpUtils {
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream(), "utf-8"));
|
||||
connection.getInputStream(), StandardCharsets.UTF_8));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user