本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}