当前位置: 首页>>代码示例>>Java>>正文


Java HttpConfigurable.isRealProxy方法代码示例

本文整理汇总了Java中com.intellij.util.net.HttpConfigurable.isRealProxy方法的典型用法代码示例。如果您正苦于以下问题:Java HttpConfigurable.isRealProxy方法的具体用法?Java HttpConfigurable.isRealProxy怎么用?Java HttpConfigurable.isRealProxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.net.HttpConfigurable的用法示例。


在下文中一共展示了HttpConfigurable.isRealProxy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIdeaDefinedProxy

import com.intellij.util.net.HttpConfigurable; //导入方法依赖的package包/类
@Nullable
public static Proxy getIdeaDefinedProxy(@NotNull final SVNURL url) {
  // SVNKit authentication implementation sets repositories as noProxy() to provide custom proxy authentication logic - see for instance,
  // SvnAuthenticationManager.getProxyManager(). But noProxy() setting is not cleared correctly in all cases - so if svn command
  // (for command line) is executed on thread where repository url was added as noProxy() => proxies are not retrieved for such commands
  // and execution logic is incorrect.

  // To prevent such behavior repositoryUrl is manually removed from noProxy() list (for current thread).
  // NOTE, that current method is only called from code flows for executing commands through command line client and should not be called
  // from SVNKit code flows.
  CommonProxy.getInstance().removeNoProxy(url.getProtocol(), url.getHost(), url.getPort());

  final List<Proxy> proxies = CommonProxy.getInstance().select(URI.create(url.toString()));
  if (proxies != null && !proxies.isEmpty()) {
    for (Proxy proxy : proxies) {
      if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
        return proxy;
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AuthenticationService.java

示例2: createRestClient

import com.intellij.util.net.HttpConfigurable; //导入方法依赖的package包/类
public static RestClient createRestClient(String location, String domain, String project, String username, String password, RestClient.SessionStrategy strategy) {
    RestClient restClient = factory.create(location, domain, project, username, password, strategy);
    restClient.setEncoding(null);
    restClient.setTimeout(10000);
    HttpConfigurable httpConfigurable = HttpConfigurable.getInstance();
    IdeaWideProxySelector proxySelector = new IdeaWideProxySelector(httpConfigurable);
    List<Proxy> proxies = proxySelector.select(VfsUtil.toUri(location));
    if (proxies != null) {
        for (Proxy proxy: proxies) {
            if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
                InetSocketAddress address = (InetSocketAddress)proxy.address();
                restClient.setHttpProxy(address.getHostName(), address.getPort());

                // not sure how IdeaWideAuthenticator & co. is supposed to work, let's try something simple:
                if(httpConfigurable.PROXY_AUTHENTICATION) {
                    PasswordAuthentication authentication = httpConfigurable.getPromptedAuthentication("HP ALI", address.getHostName());
                    if(authentication != null) {
                        restClient.setHttpProxyCredentials(authentication.getUserName(), new String(authentication.getPassword()));
                    }
                }
                break;
            }
        }
    }
    return restClient;
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:27,代码来源:RestService.java

示例3: getIdeaDefinedProxy

import com.intellij.util.net.HttpConfigurable; //导入方法依赖的package包/类
@Nullable
private static Proxy getIdeaDefinedProxy(final SVNURL url) throws URISyntaxException {
  final List<Proxy> proxies = CommonProxy.getInstance().select(new URI(url.toString()));
  if (proxies != null && ! proxies.isEmpty()) {
    for (Proxy proxy : proxies) {
      if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
        return proxy;
      }
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:IdeaSvnkitBasedAuthenticationCallback.java

示例4: createProxy

import com.intellij.util.net.HttpConfigurable; //导入方法依赖的package包/类
private ISVNProxyManager createProxy(SVNURL url) {
  // this code taken from default manager (changed for system properties reading)
  String host = url.getHost();

  String proxyHost = getServersPropertyIdea(host, HTTP_PROXY_HOST);
  if (StringUtil.isEmptyOrSpaces(proxyHost)) {
    if (getConfig().isIsUseDefaultProxy()) {
      // ! use common proxy if it is set
      try {
        final List<Proxy> proxies = HttpConfigurable.getInstance().getOnlyBySettingsSelector().select(new URI(url.toString()));
        if (proxies != null && ! proxies.isEmpty()) {
          for (Proxy proxy : proxies) {
            if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
              final SocketAddress address = proxy.address();
              if (address instanceof InetSocketAddress) {
                return new MyPromptingProxyManager(((InetSocketAddress)address).getHostName(),
                                                   String.valueOf(((InetSocketAddress)address).getPort()), url.getProtocol());
              }
            }
          }
        }
      }
      catch (URISyntaxException e) {
        LOG.info(e);
      }
    }
    return null;
  }
  String proxyExceptions = getServersPropertyIdea(host, "http-proxy-exceptions");
  String proxyExceptionsSeparator = ",";
  if (proxyExceptions == null) {
      proxyExceptions = System.getProperty("http.nonProxyHosts");
      proxyExceptionsSeparator = "|";
  }
  if (proxyExceptions != null) {
    for(StringTokenizer exceptions = new StringTokenizer(proxyExceptions, proxyExceptionsSeparator); exceptions.hasMoreTokens();) {
        String exception = exceptions.nextToken().trim();
        if (DefaultSVNOptions.matches(exception, host)) {
            return null;
        }
    }
  }
  String proxyPort = getServersPropertyIdea(host, HTTP_PROXY_PORT);
  String proxyUser = getServersPropertyIdea(host, HTTP_PROXY_USERNAME);
  String proxyPassword = getServersPropertyIdea(host, HTTP_PROXY_PASSWORD);
  return new MySimpleProxyManager(proxyHost, proxyPort, proxyUser, proxyPassword);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:SvnAuthenticationManager.java

示例5: createProxy

import com.intellij.util.net.HttpConfigurable; //导入方法依赖的package包/类
private ISVNProxyManager createProxy(SVNURL url) {
  // this code taken from default manager (changed for system properties reading)
  String host = url.getHost();

  String proxyHost = getServersPropertyIdea(host, HTTP_PROXY_HOST);
  if ((proxyHost == null) || "".equals(proxyHost.trim())) {
    if (getConfig().isIsUseDefaultProxy()) {
      // ! use common proxy if it is set
      try {
        final List<Proxy> proxies = HttpConfigurable.getInstance().getOnlyBySettingsSelector().select(new URI(url.toString()));
        if (proxies != null && ! proxies.isEmpty()) {
          for (Proxy proxy : proxies) {
            if (HttpConfigurable.isRealProxy(proxy) && Proxy.Type.HTTP.equals(proxy.type())) {
              final SocketAddress address = proxy.address();
              if (address instanceof InetSocketAddress) {
                return new MyPromptingProxyManager(((InetSocketAddress)address).getHostName(), "" + ((InetSocketAddress)address).getPort(),
                                                   url.getProtocol());
              }
            }
          }
        }
      }
      catch (URISyntaxException e) {
        LOG.info(e);
      }
    }
    return null;
  }
  String proxyExceptions = getServersPropertyIdea(host, "http-proxy-exceptions");
  String proxyExceptionsSeparator = ",";
  if (proxyExceptions == null) {
      proxyExceptions = System.getProperty("http.nonProxyHosts");
      proxyExceptionsSeparator = "|";
  }
  if (proxyExceptions != null) {
    for(StringTokenizer exceptions = new StringTokenizer(proxyExceptions, proxyExceptionsSeparator); exceptions.hasMoreTokens();) {
        String exception = exceptions.nextToken().trim();
        if (DefaultSVNOptions.matches(exception, host)) {
            return null;
        }
    }
  }
  String proxyPort = getServersPropertyIdea(host, HTTP_PROXY_PORT);
  String proxyUser = getServersPropertyIdea(host, HTTP_PROXY_USERNAME);
  String proxyPassword = getServersPropertyIdea(host, HTTP_PROXY_PASSWORD);
  return new MySimpleProxyManager(proxyHost, proxyPort, proxyUser, proxyPassword);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:48,代码来源:SvnAuthenticationManager.java


注:本文中的com.intellij.util.net.HttpConfigurable.isRealProxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。