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


Java Proxy类代码示例

本文整理汇总了Java中org.eclipse.aether.repository.Proxy的典型用法代码示例。如果您正苦于以下问题:Java Proxy类的具体用法?Java Proxy怎么用?Java Proxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: newRepositorySystemSession

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
private DefaultRepositorySystemSession newRepositorySystemSession(RepositorySystem system, String localRepoPath) {
	DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
	LocalRepository localRepo = new LocalRepository(localRepoPath);
	session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));
	session.setOffline(this.properties.isOffline());
	if (this.properties.getConnectTimeout() != null) {
		session.setConfigProperty(ConfigurationProperties.CONNECT_TIMEOUT, this.properties.getConnectTimeout());
	}
	if (this.properties.getRequestTimeout() != null) {
		session.setConfigProperty(ConfigurationProperties.REQUEST_TIMEOUT, this.properties.getRequestTimeout());
	}
	if (isProxyEnabled()) {
		DefaultProxySelector proxySelector = new DefaultProxySelector();
		Proxy proxy = new Proxy(this.properties.getProxy().getProtocol(),
				this.properties.getProxy().getHost(),
				this.properties.getProxy().getPort(),
				this.authentication);
		proxySelector.add(proxy, this.properties.getProxy().getNonProxyHosts());
		session.setProxySelector(proxySelector);
	}
	return session;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer,代码行数:23,代码来源:MavenArtifactResolver.java

示例2: initRemoteRepositories

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
private List<RemoteRepository> initRemoteRepositories() {
    List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
    List<RemoteRepository.Builder> builders = new ArrayList<RemoteRepository.Builder>();

    List<RemoteRepository> pullRemoteRepo = this.mvnConsumerConfigurer.getPullRemoteRepo();
    for (RemoteRepository aPullRemoteRepository : pullRemoteRepo) {
        builders.add(new RemoteRepository.Builder(aPullRemoteRepository));
    }


    // Add this to support proxy configuration
    for (RemoteRepository.Builder builder : builders) {
        logger.debug("Processing builder {}",builder);
        if (mvnProxySelector != null) {
            logger.debug("Proxy selector {} found for builder {}",mvnProxySelector,builder);
            RemoteRepository remoteRepo = builder.build();
            Proxy proxy = mvnProxySelector.getProxy(remoteRepo);
            if (proxy != null) {
                logger.debug("[repo:{}] => setProxy({})", remoteRepo.getHost(), proxy.toString());
                builder.setProxy(proxy);
            }
        }
        remoteRepositories.add(builder.build());
    }
    return remoteRepositories;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:27,代码来源:MvnRepoDaoImpl.java

示例3: selectProxies

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
public ProxySelector selectProxies() {
    DefaultProxySelector proxySelector = new DefaultProxySelector();
    String httpProxyHost = System.getProperty("http.proxyHost");
    if (httpProxyHost != null) {
        logger.debug("Setting same proxy for http and https");
        int proxyPort = -1;
        try {
            proxyPort = Integer.parseInt(System.getProperty("http.proxyPort"));
        } catch (NumberFormatException nfe) {
            throw new RuntimeException("Invalid (or null) http.proxyPort specified into system.properties");
        }
        String nonProxyHosts = System.getProperty("http.nonProxyHosts");
        nonProxyHosts = (nonProxyHosts != null ? nonProxyHosts : "");
        Proxy httpProxy = new Proxy("http", httpProxyHost, proxyPort, null);
        Proxy httpsProxy = new Proxy("https", httpProxyHost, proxyPort, null);

        proxySelector.add(httpProxy, nonProxyHosts);
        proxySelector.add(httpsProxy, nonProxyHosts);
        logger.debug("MvnRepo proxy set to {}:{}" + (nonProxyHosts != null ? " (nonProxyHosts:" + nonProxyHosts + ")" : ""), httpProxyHost, proxyPort);
    } else {
        logger.debug("No proxy set (http.proxyHost not defined).");

    }
    return proxySelector;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:26,代码来源:ProxyManager.java

示例4: getProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
@Override
public Proxy getProxy(RemoteRepository repository) {
	for (ProxySelector selector : this.selectors) {
		Proxy proxy = selector.getProxy(repository);
		if (proxy != null) {
			return proxy;
		}
	}
	return null;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:CompositeProxySelector.java

示例5: assertProxySelectorConfiguration

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
private void assertProxySelectorConfiguration(DefaultRepositorySystemSession session,
		RemoteRepository repository) {
	Proxy proxy = session.getProxySelector().getProxy(repository);
	repository = new RemoteRepository.Builder(repository).setProxy(proxy).build();
	AuthenticationContext authenticationContext = AuthenticationContext
			.forProxy(session, repository);
	assertThat(proxy.getHost()).isEqualTo("proxy.example.com");
	assertThat(authenticationContext.get(AuthenticationContext.USERNAME))
			.isEqualTo("proxyuser");
	assertThat(authenticationContext.get(AuthenticationContext.PASSWORD))
			.isEqualTo("somepassword");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:SettingsXmlRepositorySystemSessionAutoConfigurationTests.java

示例6: createProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
protected Proxy createProxy(){
	for (ProxyConfig c : getProxies()){
		if (c.getActive().booleanValue()){
			return c.createProxy();
		}
	}
	return null;					
}
 
开发者ID:microsofia,项目名称:microsofia-boot,代码行数:9,代码来源:Settings.java

示例7: buildRemoteRepository

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
private RemoteRepository buildRemoteRepository(final String id, final String url, final Authentication auth,
                                               final ArtifactRepositoryPolicy releasesPolicy, final ArtifactRepositoryPolicy snapshotsPolicy) {
    RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url);
    if (auth != null
            && auth.getUsername() != null
            && auth.getPassword() != null) {
        builder.setAuthentication(new AuthenticationBuilder()
                                          .addUsername(auth.getUsername())
                                          .addPassword(auth.getPassword()).build());
    }

    builder.setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy()));
    builder.setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy()));

    RemoteRepository repository = builder.build();

    final RemoteRepository mirror = session.getMirrorSelector().getMirror(repository);

    if (mirror != null) {
        final org.eclipse.aether.repository.Authentication mirrorAuth = session.getAuthenticationSelector()
                .getAuthentication(mirror);
        RemoteRepository.Builder mirrorBuilder = new RemoteRepository.Builder(mirror)
                .setId(repository.getId())
                .setSnapshotPolicy(new RepositoryPolicy(snapshotsPolicy.isEnabled(), snapshotsPolicy.getUpdatePolicy(), snapshotsPolicy.getChecksumPolicy()))
                .setReleasePolicy(new RepositoryPolicy(releasesPolicy.isEnabled(), releasesPolicy.getUpdatePolicy(), releasesPolicy.getChecksumPolicy()));
        if (mirrorAuth != null) {
            mirrorBuilder.setAuthentication(mirrorAuth);
        }
        repository = mirrorBuilder.build();
    }

    Proxy proxy = session.getProxySelector().getProxy(repository);

    if (proxy != null) {
        repository = new RemoteRepository.Builder(repository).setProxy(proxy).build();
    }

    return repository;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:40,代码来源:MavenArtifactResolvingHelper.java

示例8: assertProxySelectorConfiguration

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
private void assertProxySelectorConfiguration(DefaultRepositorySystemSession session,
		RemoteRepository repository) {
	Proxy proxy = session.getProxySelector().getProxy(repository);
	repository = new RemoteRepository.Builder(repository).setProxy(proxy).build();
	AuthenticationContext authenticationContext = AuthenticationContext
			.forProxy(session, repository);
	assertEquals("proxy.example.com", proxy.getHost());
	assertEquals("proxyuser",
			authenticationContext.get(AuthenticationContext.USERNAME));
	assertEquals("somepassword",
			authenticationContext.get(AuthenticationContext.PASSWORD));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:SettingsXmlRepositorySystemSessionAutoConfigurationTests.java

示例9: getProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
private static Proxy getProxy ( final String url )
{
    final ProxySelector ps = ProxySelector.getDefault ();
    if ( ps == null )
    {
        logger.debug ( "No proxy selector found" );
        return null;
    }

    final List<java.net.Proxy> proxies = ps.select ( URI.create ( url ) );
    for ( final java.net.Proxy proxy : proxies )
    {
        if ( proxy.type () != Type.HTTP )
        {
            logger.debug ( "Unsupported proxy type: {}", proxy.type () );
            continue;
        }

        final SocketAddress addr = proxy.address ();
        logger.debug ( "Proxy address: {}", addr );

        if ( ! ( addr instanceof InetSocketAddress ) )
        {
            logger.debug ( "Unsupported proxy address type: {}", addr.getClass () );
            continue;
        }

        final InetSocketAddress inetAddr = (InetSocketAddress)addr;

        return new Proxy ( Proxy.TYPE_HTTP, inetAddr.getHostString (), inetAddr.getPort () );
    }

    logger.debug ( "No proxy found" );
    return null;
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:36,代码来源:Helper.java

示例10: createProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
public Proxy createProxy(){
	return new Proxy(getProtocol(),getHost(),getPort());
}
 
开发者ID:microsofia,项目名称:microsofia-boot,代码行数:4,代码来源:ProxyConfig.java

示例11: getProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
@Override
public Proxy getProxy() {
	return proxy;
}
 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:5,代码来源:AetherClasspathResolver.java

示例12: setProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
@Override
public void setProxy(Proxy proxy) {
	this.proxy = proxy;
}
 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:5,代码来源:AetherClasspathResolver.java

示例13: withProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
@Override
public AetherClasspathResolver withProxy(Proxy proxy) {
	setProxy(proxy);
	return this;
}
 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:6,代码来源:AetherClasspathResolver.java

示例14: setProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
public SoapUIMockRunner setProxy(String type, String host, int port,
		String username, String password) {

	Authentication auth = new AuthenticationBuilder().addUsername(username)
			.addPassword(password).build();

	resolver.setProxy(new Proxy(type, host, port, auth));

	return this;
}
 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:11,代码来源:SoapUIMockRunner.java

示例15: getProxy

import org.eclipse.aether.repository.Proxy; //导入依赖的package包/类
public Proxy getProxy(); 
开发者ID:bertramn,项目名称:soapui-junit-mockrunner,代码行数:2,代码来源:ClasspathResolver.java


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