火点转发-乱码
This commit is contained in:
parent
94a90a8f1e
commit
ad57a3e46f
@ -510,7 +510,7 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
private void forwardPoint(FirePointEntity firePointEntity) {
|
||||
try {
|
||||
String url = "http://121.36.229.60:6811/insertfirepointchannelThree";
|
||||
HttpClientUtils.sendHttpPost(url, new ObjectMapper().writeValueAsString(firePointEntity));
|
||||
HttpClientUtils.sendHttpPostTextPlain(url, new ObjectMapper().writeValueAsString(firePointEntity));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -75,6 +75,23 @@ public class HttpClientUtils {
|
||||
return doPost(httpClient, url, params);
|
||||
}
|
||||
|
||||
public static String sendHttpPostTextPlain(String url, String params) throws Exception {
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
return doPostTextPlain(httpClient, url, params);
|
||||
}
|
||||
|
||||
private static String doPostTextPlain(CloseableHttpClient httpClient, String url, String params) throws Exception {
|
||||
log.info("Post请求url:{}", url);
|
||||
log.info("Post请求params:{}", params);
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.addHeader("Content-Type", "application/json; charset=utf-8");
|
||||
StringEntity requestEntity = new StringEntity(params, "UTF-8");
|
||||
requestEntity.setContentType("text/plain");
|
||||
requestEntity.setContentEncoding("UTF-8");
|
||||
httpPost.setEntity(requestEntity);
|
||||
return execute(httpClient, httpPost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送https+post请求
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user