mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix header
This commit is contained in:
parent
500be4aaba
commit
684bc1b6ae
@ -6,6 +6,8 @@
|
||||
## 4.6.4
|
||||
|
||||
### 新特性
|
||||
* 【http】 自动关闭HttpURLConnection的头安全检查(issue#512@Github)
|
||||
* 【setting】 Setting变量替换支持从系统参数中取值
|
||||
|
||||
### Bug修复
|
||||
* 【db】 解决ThreadLocalConnection多数据源被移除问题(pr#66@Gitee)
|
||||
|
@ -37,6 +37,10 @@ public enum GlobalHeaders {
|
||||
* @return this
|
||||
*/
|
||||
public GlobalHeaders putDefault(boolean isReset) {
|
||||
// 解决HttpURLConnection中无法自定义Host等头信息的问题
|
||||
// https://stackoverflow.com/questions/9096987/how-to-overwrite-http-header-host-in-a-httpurlconnection/9098440
|
||||
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
|
||||
|
||||
if (isReset) {
|
||||
this.headers.clear();
|
||||
}
|
||||
|
@ -201,22 +201,23 @@ public class SettingLoader {
|
||||
for (String var : vars) {
|
||||
key = ReUtil.get(reg_var, var, 1);
|
||||
if (StrUtil.isNotBlank(key)) {
|
||||
// 查找变量名对应的值
|
||||
// 本分组中查找变量名对应的值
|
||||
String varValue = this.groupedMap.get(group, key);
|
||||
if (null != varValue) {
|
||||
// 替换标识
|
||||
value = value.replace(var, varValue);
|
||||
} else {
|
||||
// 跨分组查找
|
||||
// 跨分组查找
|
||||
if (null == varValue) {
|
||||
final List<String> groupAndKey = StrUtil.split(key, CharUtil.DOT, 2);
|
||||
if (groupAndKey.size() > 1) {
|
||||
varValue = this.groupedMap.get(groupAndKey.get(0), groupAndKey.get(1));
|
||||
if (null != varValue) {
|
||||
// 替换标识
|
||||
value = value.replace(var, varValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 系统参数中查找
|
||||
if(null == varValue) {
|
||||
varValue = System.getProperty(key);
|
||||
}
|
||||
if (null != varValue) {
|
||||
// 替换标识
|
||||
value = value.replace(var, varValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user