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


Java Proxy.getProtocol方法代码示例

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


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

示例1: getProxyConfig

import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
static ProxyConfig getProxyConfig(MavenSession mavenSession) {
  if (
          mavenSession == null ||
                  mavenSession.getSettings() == null ||
                  mavenSession.getSettings().getActiveProxy() == null ||
                  !mavenSession.getSettings().getActiveProxy().isActive()
          ) {
    return null;
  } else {
    Proxy mavenProxy = mavenSession.getSettings().getActiveProxy();
    return new ProxyConfig(
            mavenProxy.getProtocol(),
            mavenProxy.getHost(),
            mavenProxy.getPort(),
            mavenProxy.getUsername(),
            mavenProxy.getPassword());
  }
}
 
开发者ID:RabbitStewDio,项目名称:frontend-tomcat-maven-plugin,代码行数:19,代码来源:MojoUtils.java

示例2: ProxySettings

import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
public ProxySettings(@Nonnull final Proxy mavenProxy) {
    this.protocol = mavenProxy.getProtocol();
    this.host = mavenProxy.getHost();
    this.port = mavenProxy.getPort();
    this.username = mavenProxy.getUsername();
    this.password = mavenProxy.getPassword();
    this.nonProxyHosts = mavenProxy.getNonProxyHosts();
}
 
开发者ID:raydac,项目名称:mvn-golang,代码行数:9,代码来源:ProxySettings.java

示例3: setProxySystemProperties

import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
public void setProxySystemProperties() {
  Proxy activeProxy = session.getSettings().getActiveProxy();

  if (activeProxy != null && activeProxy.getProtocol() != null && activeProxy.getProtocol().contains("http")) {
    log.debug("Setting proxy properties");
    System.setProperty("http.proxyHost", activeProxy.getHost());
    System.setProperty("http.proxyPort", String.valueOf(activeProxy.getPort()));
    System.setProperty("http.proxyUser", StringUtils.defaultString(activeProxy.getUsername(), ""));
    System.setProperty("http.proxyPassword", StringUtils.defaultString(activeProxy.getPassword(), ""));
    System.setProperty("http.nonProxyHosts", StringUtils.defaultString(activeProxy.getNonProxyHosts(), ""));
  }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:13,代码来源:ScannerFactory.java

示例4: DependencyAuditor

import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/** Make a new dependency auditor with proxies
 */
public DependencyAuditor(List<Proxy> proxies) {
    request = OssIndexApi.createPackageRequest();
    for (Proxy proxy : proxies) {
        String nonProxyHosts = proxy.getNonProxyHosts();
        boolean ignore = false;
        String protocol = proxy.getProtocol();
        // We only support HTTP(S)
        switch (protocol) {
            case "http":
            case "https":
                break;
            default:
                ignore = true;
                break;
        }
        // Were we told to ignore this proxy server?
        if (nonProxyHosts != null) {
            String[] tokens = nonProxyHosts.split("|");
            for (String token : tokens) {
                token = token.trim();
                if ("ossindex.net".equalsIgnoreCase(token)) {
                    ignore = true;
                }
            }
        }
        // Should we use this proxy?
        if (!ignore) {
            request.addProxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), proxy.getUsername(), proxy.getPassword());
        }
    }
}
 
开发者ID:OSSIndex,项目名称:ossindex-maven-plugin,代码行数:34,代码来源:DependencyAuditor.java

示例5: proxyConfiguration

import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/**
 * Extract configuration from given maven proxy settings.
 *
 * @param proxy Proxy.
 * @return Proxy configuration.
 */
public static ProxyConfig proxyConfiguration(Proxy proxy) {
	return new ProxyConfig(
		proxy.getProtocol(),
		proxy.getUsername(),
		proxy.getPassword(),
		proxy.getHost(),
		proxy.getPort()
	);
}
 
开发者ID:mjeanroy,项目名称:node-maven-plugin,代码行数:16,代码来源:ProxyConfig.java

示例6: activateProxy

import org.apache.maven.settings.Proxy; //导入方法依赖的package包/类
/**
 * Called to install the plugins proxy settings.
 */
protected Object activateProxy()
{
    if ( settings == null )
    {
        return null;
    }
    final Proxy proxy = settings.getActiveProxy();
    if ( proxy == null )
    {
        return null;
    }

    final List<String> properties = new ArrayList<String>();
    final String protocol = proxy.getProtocol();
    final String prefix = isEmpty( protocol ) ? "" : ( protocol + "." );

    final String host = proxy.getHost();
    final String hostProperty = prefix + "proxyHost";
    final String hostValue = isEmpty( host ) ? null : host;
    setProperty( properties, hostProperty, hostValue );
    final int port = proxy.getPort();
    final String portProperty = prefix + "proxyPort";
    final String portValue = ( port == 0 || port == -1 ) ? null : String.valueOf( port );
    setProperty( properties, portProperty, portValue );
    final String username = proxy.getUsername();
    final String userProperty = prefix + "proxyUser";
    final String userValue = isEmpty( username ) ? null : username;
    setProperty( properties, userProperty, userValue );
    final String password = proxy.getPassword();
    final String passwordProperty = prefix + "proxyPassword";
    final String passwordValue = isEmpty( password ) ? null : password;
    setProperty( properties, passwordProperty, passwordValue );
    final String nonProxyHosts = proxy.getNonProxyHosts();
    final String nonProxyHostsProperty = prefix + "nonProxyHosts";
    final String nonProxyHostsValue = isEmpty( nonProxyHosts ) ? null : nonProxyHosts.replace( ',', '|' );
    setProperty( properties, nonProxyHostsProperty, nonProxyHostsValue );
    getLog().debug( "Proxy settings: " + hostProperty + "=" + hostValue + ", " + portProperty + "=" + portValue
        + ", " + userProperty + "=" + userValue + ", " + passwordProperty + "="
        + ( passwordValue == null ? "null" : "<PasswordNotLogged>" ) + ", " + nonProxyHostsProperty + "="
        + nonProxyHostsValue );
    return properties;
}
 
开发者ID:mojohaus,项目名称:xml-maven-plugin,代码行数:46,代码来源:AbstractXmlMojo.java


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