如何以编程方式获取 IntelliJ 代理设置?

问题描述 投票:0回答:1

HttpConfigurable 类在 2024.2 版本已被弃用,当我使用 HttpConfigurable.getInstance() 获取主机、登录名等代理数据时,会警告:'com.智能。实用程序。网。 HttpConfigurable' 已弃用并标记为删除。还有其他方法获取代理数据吗?

我尝试按照https://intellij-support.jetbrains.com/hc/en-us/community/posts/206755245-How-to-access-IntelliJ-proxy-data-programmatically所说,但编译时显示警告: 警告:[删除] com.intellij.util.net 中的 HttpConfigurable 已弃用并标记为删除 HttpConfigurable proxySettings = HttpConfigurable.getInstance();

intellij-idea http-proxy intellij-plugin
1个回答
0
投票

HttpConfigurable
中的文档请您参考具体方法的弃用通知:

/**
* @deprecated Use {@link ProxySettings}, {@link ProxyAuthentication}, {@link HttpConnectionUtils}, and {@link ProxyUtils} instead.
* See method deprecation notices for more details.
* <p/>
* For removal in version 24.3
*/

例如,根据

getProxyLogin()
的文档,您应该使用
ProxyUtils#getStaticProxyCredentials
的版本。

/** @deprecated use {@link ProxyUtils#getStaticProxyCredentials(ProxySettings, ProxyCredentialProvider)} or {@link ProxyUtils#setStaticProxyCredentials(ProxySettings, ProxyCredentialStore, Credentials, boolean)} */
  @Deprecated(forRemoval = true)
  @Transient
  public @Nullable String getProxyLogin() {
    return getSecure("proxy.login");
  }
© www.soinside.com 2019 - 2024. All rights reserved.