提交 9a8adb8c 编写于 作者: wangxinxu's avatar wangxinxu

cat 去除

上级 7fb3168c
流水线 #54434 已失败 于阶段
......@@ -143,16 +143,6 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-core</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.unidal.framework</groupId>
<artifactId>foundation-service</artifactId>
......
package com.pica.cloud.online.exam.analysis.server.utils;
import org.apache.http.Consts;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
......@@ -15,11 +16,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author wuminghao
......@@ -69,6 +68,7 @@ public class HttpClient4Utils {
UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(formParams, encoding);
httpPost.setEntity(postEntity);
}
// httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
CloseableHttpResponse response = null;
try {
response = (CloseableHttpResponse) httpClient.execute(httpPost);
......@@ -86,4 +86,43 @@ public class HttpClient4Utils {
}
return resp;
}
public static void main(String[] s) {
HttpClient httpClient = HttpClient4Utils.createHttpClient(200, 200, 2000, 2000, 2000);
Map<String, String> params = new HashMap<String, String>();
/**
* 1. 设置公共参数
*/
params.put("secretId", "f437763dcf0a4096948b0cfbaebd668b");
params.put("businessId", "7065ac9c9cf4472fbf44fe3f90a03624");
params.put("version", "v1");
params.put("timestamp", String.valueOf(System.currentTimeMillis()));
params.put("nonce", String.valueOf(new Random().nextInt()));
/**
* 2. 设置私有参数
*/
// params.put("dataId", "ebfcad1c-pica-490c-b4de-e784c2691768");
params.put("name", "韦少峰");
params.put("cardNo", "440624198310214613");
/**
* 3. 生成签名信息
*/
try {
String signature = SignatureUtils.genSignature("6cc930e9e481fce8e5d3da30dddf74c4", params);
params.put("signature", signature);
} catch (UnsupportedEncodingException e) {
logger.error("processString", e);
}
/**
* 4. 发送HTTP请求
*/
System.out.println(sendPost(httpClient, "https://verify.dun.163.com/v1/idcard/check", params, Consts.UTF_8));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册