update 调用内部接口增加Header Referer

This commit is contained in:
lijiarao
2021-12-17 21:09:56 +08:00
parent 599f2cd4d1
commit 589bb43e05
@@ -82,7 +82,12 @@ public class AuthenticationUtils {
String publicKey;
//从标协项目获取公钥
try {
publicKey=HttpUtil.get(URL+"/sys/getStandardsRSAPublicKey");
//publicKey=HttpUtil.get(URL+"/sys/getStandardsRSAPublicKey");
publicKey=HttpRequest.get(URL+"/sys/getStandardsRSAPublicKey")
.header(Header.REFERER, URL+"/sys/getStandardsRSAPublicKey")//头信息,多个头信息多次调用此方法即可
.header(Header.CONTENT_TYPE, "application/json")
.timeout(20000)//超时,毫秒
.execute().body();
}catch (Exception e){
throw new JeroBootException("数据同步失败!连接超时");
}
@@ -145,7 +150,8 @@ public class AuthenticationUtils {
}
String post = HttpRequest.post(urlBuilder.toString())
.header(Header.REFERER, urlBuilder.toString())//头信息,多个头信息多次调用此方法即可
.form(jsonString)//表单内容
.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
.body(jsonString)//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
//String post = HttpUtil.post(urlBuilder.toString(), jsonString);
@@ -171,7 +177,8 @@ public class AuthenticationUtils {
}
String post = HttpRequest.post(urlBuilder.toString())
.header(Header.REFERER, urlBuilder.toString())//头信息,多个头信息多次调用此方法即可
.form(jsonString)//表单内容
.header(Header.CONTENT_TYPE, "application/json")
.body(jsonString)//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
//String post = HttpUtil.post(urlBuilder.toString(), jsonString);
@@ -193,6 +200,7 @@ public class AuthenticationUtils {
paramMap.forEach((k,v) -> urlBuilder.append(k).append("=").append(v).append("&"));
String get = HttpRequest.get(urlBuilder.toString())
.header(Header.REFERER, urlBuilder.toString())//头信息,多个头信息多次调用此方法即可
.header(Header.CONTENT_TYPE, "application/json")
.timeout(20000)//超时,毫秒
.execute().body();
//String get = HttpUtil.get(urlBuilder.toString());