1
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user