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


Java IProxyData.getUserId方法代码示例

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


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

示例1: getProxyConfiguration

import org.eclipse.core.net.proxy.IProxyData; //导入方法依赖的package包/类
protected ProxyConfiguration getProxyConfiguration() {
	try {
		IProxyData proxyData = CloudServerUtil.getProxy(new URL(cloudServer.getUrl()));
		if (proxyData != null) {
			String proxyHost = proxyData.getHost();
			int proxyPort = proxyData.getPort();
			String user = proxyData.getUserId();
			String password = proxyData.getPassword();
			return ProxyConfiguration.builder().host(proxyHost)
					.port(proxyPort == -1 ? Optional.empty() : Optional.of(proxyPort))
					.username(Optional.ofNullable(user)).password(Optional.ofNullable(password)).build();
		}
	} catch (MalformedURLException e) {
		CloudFoundryPlugin.logError(e);
	}
	return null;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:18,代码来源:V2Client.java

示例2: getProxy

import org.eclipse.core.net.proxy.IProxyData; //导入方法依赖的package包/类
public static HttpProxyConfiguration getProxy(URL url) {
	if (url == null) {
		return null;
	}
	// In certain cases, the activator would have stopped and the plugin may
	// no longer be available. Usually onl happens on shutdown.
	CloudFoundryPlugin plugin = CloudFoundryPlugin.getDefault();
	if (plugin != null) {
		IProxyService proxyService = plugin.getProxyService();
		if (proxyService != null) {
			try {
				IProxyData[] selectedProxies = proxyService.select(url.toURI());

				// No proxy configured or not found
				if (selectedProxies == null || selectedProxies.length == 0) {
					return null;
				}

				IProxyData data = selectedProxies[0];
				int proxyPort = data.getPort();
				String proxyHost = data.getHost();
				String user = data.getUserId();
				String password = data.getPassword();
				return proxyHost != null ? new HttpProxyConfiguration(proxyHost, proxyPort,
						data.isRequiresAuthentication(), user, password) : null;
			}
			catch (URISyntaxException e) {
				// invalid url (protocol, ...) => proxy will be null
			}
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:34,代码来源:CloudFoundryClientFactory.java

示例3: getProxyUser

import org.eclipse.core.net.proxy.IProxyData; //导入方法依赖的package包/类
@Override
public String getProxyUser() {
    if (!isProxiesEnabled()) {
        return Constants.EMPTY_STRING;
    }

    IProxyData httpProxyData = getHttpProxyData();
    if (httpProxyData == null) {
        return Constants.EMPTY_STRING;
    }

    if (!httpProxyData.isRequiresAuthentication()) {
        return Constants.EMPTY_STRING;
    }

    if (Utils.isNotEmpty(httpProxyData.getUserId())) {
        if (logger.isDebugEnabled()) {
            logger.debug("Returning '" + httpProxyData.getUserId() + "' as proxy user");
        }
        return httpProxyData.getUserId();
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("Returning blank/null proxy user");
        }
        return Constants.EMPTY_STRING;
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:28,代码来源:NetworkConnectionProxy.java

示例4: ProxyConfig

import org.eclipse.core.net.proxy.IProxyData; //导入方法依赖的package包/类
public ProxyConfig(IProxyService proxyService, URI uri){
	IProxyData[] proxyDataForHost = proxyService.select(uri);
	for (IProxyData data : proxyDataForHost) {
		if (data.getHost() != null) {
			host      = data.getHost();
			port      = data.getPort();
			userId    = data.getUserId();
			password  = data.getPassword();
		}
	}
}
 
开发者ID:Jarlakxen,项目名称:eclipse-sbt-plugin,代码行数:12,代码来源:SbtExecutor.java

示例5: getProxy

import org.eclipse.core.net.proxy.IProxyData; //导入方法依赖的package包/类
public static HttpProxyConfiguration getProxy(URL url) {

		// URL must be set and have a valid protocol in order to determine
		// which proxy to use
		if (url == null || url.getProtocol() == null) {
			return null;
		}
		// In certain cases, the activator would have stopped and the plugin may
		// no longer be available. Usually onl happens on shutdown.

		DockerFoundryPlugin plugin = DockerFoundryPlugin.getDefault();

		if (plugin != null) {
			IProxyService proxyService = plugin.getProxyService();

			// Only set proxies IF proxies are enabled (i.e a user has selected
			// MANUAL provider configuration in network preferences. If it is
			// direct,
			// then skip proxy settings.
			if (proxyService != null && proxyService.isProxiesEnabled()) {
				IProxyData[] existingProxies = proxyService.getProxyData();

				if (existingProxies != null) {

					// Now determine the protocol to obtain the correct proxy
					// type
					String normalisedURLProtocol = getNormalisedProtocol(url.getProtocol());

					// Resolve the correct proxy data type based on the URL
					// protocol
					String[] proxyDataTypes = { IProxyData.HTTP_PROXY_TYPE, IProxyData.HTTPS_PROXY_TYPE,
							IProxyData.SOCKS_PROXY_TYPE };
					String matchedProxyData = null;
					for (String proxyDataType : proxyDataTypes) {
						String normalised = getNormalisedProtocol(proxyDataType);
						if (normalised.equals(normalisedURLProtocol)) {
							matchedProxyData = proxyDataType;
							break;
						}
					}

					if (matchedProxyData != null) {
						for (IProxyData data : existingProxies) {

							if (matchedProxyData.equals(data.getType())) {
								int proxyPort = data.getPort();
								String proxyHost = data.getHost();
								String user = data.getUserId();
								String password = data.getPassword();
								return proxyHost != null ? new HttpProxyConfiguration(proxyHost, proxyPort,
										data.isRequiresAuthentication(), user, password) : null;
							}
						}
					}
				}
			}
		}

		return null;

	}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:62,代码来源:DockerFoundryClientFactory.java


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