This commit is contained in:
2025-11-05 23:51:15 +08:00
parent ce0bd978b6
commit ad9e3cb8e8

View File

@@ -22,6 +22,17 @@ public class TencentDocApiUtil {
private static final Logger log = LoggerFactory.getLogger(TencentDocApiUtil.class);
// 静态初始化块禁用系统代理确保腾讯文档API调用直接连接
static {
System.setProperty("java.net.useSystemProxies", "false");
// 清除可能存在的代理设置
System.clearProperty("http.proxyHost");
System.clearProperty("http.proxyPort");
System.clearProperty("https.proxyHost");
System.clearProperty("https.proxyPort");
log.info("已禁用系统代理设置腾讯文档API将直接连接");
}
/**
* 获取访问令牌
*
@@ -175,9 +186,6 @@ public class TencentDocApiUtil {
java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy);
// 禁用系统代理设置(双重保险)
System.setProperty("java.net.useSystemProxies", "false");
conn.setRequestMethod(method);
conn.setRequestProperty("Authorization", "Bearer " + accessToken);
conn.setRequestProperty("Content-Type", "application/json");