本文整理了Java中org.eclipse.aether.repository.Proxy.<init>()
方法的一些代码示例,展示了Proxy.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Proxy.<init>()
方法的具体详情如下:
包路径:org.eclipse.aether.repository.Proxy
类名称:Proxy
方法名:<init>
[英]Creates a new proxy with the specified properties and no authentication.
[中]
代码示例来源:origin: apache/storm
private static Proxy parseProxyArg(String proxyUrl, String proxyUsername, String proxyPassword) throws MalformedURLException {
URL url = new URL(proxyUrl);
if (StringUtils.isNotEmpty(proxyUsername) && StringUtils.isNotEmpty(proxyPassword)) {
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername(proxyUsername).addPassword(proxyPassword);
return new Proxy(url.getProtocol(), url.getHost(), url.getPort(), authBuilder.build());
} else {
return new Proxy(url.getProtocol(), url.getHost(), url.getPort());
}
}
代码示例来源:origin: apache/incubator-druid
private DefaultTeslaAether createTeslaAether(List<Repository> remoteRepositories)
{
if (!useProxy) {
return new DefaultTeslaAether(
localRepository,
remoteRepositories.toArray(new Repository[0])
);
}
if (!StringUtils.toLowerCase(proxyType).equals(Proxy.TYPE_HTTP) && !StringUtils.toLowerCase(proxyType).equals(Proxy.TYPE_HTTPS)) {
throw new IllegalArgumentException("invalid proxy type: " + proxyType);
}
RepositorySystemSession repositorySystemSession = new RepositorySystemSessionProvider(new File(localRepository)).get();
List<RemoteRepository> rl = remoteRepositories.stream().map(r -> {
RemoteRepository.Builder builder = new RemoteRepository.Builder(r.getId(), "default", r.getUrl());
if (r.getUsername() != null && r.getPassword() != null) {
Authentication auth = new AuthenticationBuilder().addUsername(r.getUsername()).addPassword(r.getPassword()).build();
builder.setAuthentication(auth);
}
final Authentication proxyAuth;
if (Strings.isNullOrEmpty(proxyUsername)) {
proxyAuth = null;
} else {
proxyAuth = new AuthenticationBuilder().addUsername(proxyUsername).addPassword(proxyPassword).build();
}
builder.setProxy(new Proxy(proxyType, proxyHost, proxyPort, proxyAuth));
return builder.build();
}).collect(Collectors.toList());
return new DefaultTeslaAether(rl, repositorySystemSession);
}
代码示例来源:origin: apache/maven
private static Proxy toProxy( org.apache.maven.repository.Proxy proxy )
{
Proxy result = null;
if ( proxy != null )
{
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( proxy.getUserName() ).addPassword( proxy.getPassword() );
result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build() );
}
return result;
}
代码示例来源:origin: apache/maven
authBuilder.addUsername( proxy.getUsername() ).addPassword( proxy.getPassword() );
proxySelector.add(
new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(),
authBuilder.build() ), proxy.getNonProxyHosts() );
代码示例来源:origin: resteasy/Resteasy
Proxy httpsProxy = null;
if (httpProxyHost != null && httpProxyPort != null && !httpProxyHost.isEmpty()) {
httpProxy = new Proxy(Proxy.TYPE_HTTP, httpProxyHost, httpProxyPort);
httpsProxy = new Proxy(Proxy.TYPE_HTTPS, httpsProxyHost, httpsProxyPort);
代码示例来源:origin: net.unit8.erebus/erebus
public Builder() {
remoteRepositories = new ArrayList<>();
RemoteRepository.Builder repoBuilder = new RemoteRepository.Builder("central", "default", "http://repo1.maven.org/maven2/");
String httpProxy = System.getenv("http_proxy");
if (httpProxy != null) {
try {
URL proxyUrl = new URL(httpProxy);
repoBuilder.setProxy(new Proxy(proxyUrl.getProtocol(), proxyUrl.getHost(), proxyUrl.getPort()));
} catch (MalformedURLException ignore) {
}
}
defaultRemoteRepository = repoBuilder.build();
}
代码示例来源:origin: org.jboss.galleon/galleon-cli
MavenProxySelector(String host, int port, String protocol, String userName,
String password, List<Pattern> nonProxyHosts) {
this.nonProxyHosts = nonProxyHosts;
if (userName != null && password != null) {
AuthenticationBuilder builder = new AuthenticationBuilder();
builder.addPassword(password);
builder.addUsername(userName);
proxy = new Proxy(protocol, host, port, builder.build());
} else {
proxy = new Proxy(protocol, host, port);
}
}
代码示例来源:origin: net.aequologica.neo/quintessence-core
public Booter() throws IOException {
super();
this.tempDirectory = new TempDirectory("local-repo");
this.geppaequoConfig = CONFIG_REGISTRY.getConfig(GeppaequoConfig.class);
if (this.geppaequoConfig.getProxyHost() != null &&
!this.geppaequoConfig.getProxyHost().isEmpty()) {
this.proxy = new Proxy(null, this.geppaequoConfig.getProxyHost(), this.geppaequoConfig.getProxyPort());
} else {
this.proxy = null;
}
}
代码示例来源:origin: org.kie.soup/kie-soup-maven-integration
private void configureProxiesOnSession( Settings settings, DefaultRepositorySystemSession session ) {
List<org.apache.maven.settings.Proxy> proxies = settings.getProxies();
if (proxies == null || proxies.isEmpty()) {
return;
}
DefaultProxySelector proxySelector = new DefaultProxySelector();
for (org.apache.maven.settings.Proxy proxy : proxies) {
proxySelector.add( new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort()), proxy.getNonProxyHosts() );
}
session.setProxySelector( proxySelector );
}
代码示例来源:origin: org.uberfire/uberfire-maven-integration
private void configureProxiesOnSession( Settings settings, DefaultRepositorySystemSession session ) {
List<org.apache.maven.settings.Proxy> proxies = settings.getProxies();
if (proxies == null || proxies.isEmpty()) {
return;
}
DefaultProxySelector proxySelector = new DefaultProxySelector();
for (org.apache.maven.settings.Proxy proxy : proxies) {
proxySelector.add( new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort()), proxy.getNonProxyHosts() );
}
session.setProxySelector( proxySelector );
}
代码示例来源:origin: io.tesla.aether.test/aether-test-harness
protected RemoteRepository repositoryConnectingViaProxy() {
Proxy proxy = new Proxy(getHttpProtocol(), "localhost", server.getPort(), null);
return new RemoteRepository.Builder(repository()).setProxy(proxy).build();
}
代码示例来源:origin: io.fabric8/fabric-maven
private ProxySelector selectProxies() {
DefaultProxySelector proxySelector = new DefaultProxySelector();
for( org.apache.maven.settings.Proxy proxy : m_settings.getProxies() ) {
String nonProxyHosts = proxy.getNonProxyHosts();
Proxy proxyObj = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(),
getAuthentication( proxy ) );
proxySelector.add( proxyObj, nonProxyHosts );
}
return proxySelector;
}
代码示例来源:origin: org.jboss.forge.furnace/furnace-manager-resolver-maven
public static org.eclipse.aether.repository.Proxy convertFromMavenProxy(org.apache.maven.settings.Proxy proxy)
{
org.eclipse.aether.repository.Proxy result = null;
if (proxy != null)
{
Authentication auth = new AuthenticationBuilder().addUsername(proxy.getUsername())
.addPassword(proxy.getPassword()).build();
result = new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
}
return result;
}
代码示例来源:origin: io.squark.yggdrasil/yggdrasil-maven-provider
private Proxy toAetherProxy(org.apache.maven.settings.Proxy mavenProxy) {
Authentication authentication = new AuthenticationBuilder().addUsername(mavenProxy.getUsername()).addPassword(
mavenProxy.getPassword()).build();
return new Proxy(mavenProxy.getProtocol(), mavenProxy.getHost(), mavenProxy.getPort(), authentication);
}
代码示例来源:origin: org.jboss.forge.addon/maven-impl-projects
public static org.eclipse.aether.repository.Proxy convertFromMavenProxy(org.apache.maven.settings.Proxy proxy)
{
org.eclipse.aether.repository.Proxy result = null;
if (proxy != null)
{
Authentication auth = new AuthenticationBuilder().addUsername(proxy.getUsername()).addPassword(proxy.getPassword()).build();
result = new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
}
return result;
}
代码示例来源:origin: io.takari.maven.plugins/takari-lifecycle-plugin
private static Proxy toProxy(org.apache.maven.repository.Proxy proxy) {
Proxy result = null;
if (proxy != null) {
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername(proxy.getUserName()).addPassword(proxy.getPassword());
result = new Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build());
}
return result;
}
代码示例来源:origin: takari/takari-lifecycle
private static Proxy toProxy(org.apache.maven.repository.Proxy proxy) {
Proxy result = null;
if (proxy != null) {
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername(proxy.getUserName()).addPassword(proxy.getPassword());
result = new Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build());
}
return result;
}
代码示例来源:origin: org.springframework.boot.experimental/spring-boot-thin-launcher
private org.eclipse.aether.repository.Proxy proxy(ArtifactRepository repo) {
org.apache.maven.repository.Proxy proxy = repo.getProxy();
if (proxy == null) {
return null;
}
Authentication authentication = new AuthenticationBuilder()
.addUsername(proxy.getUserName()).addPassword(proxy.getPassword())
.build();
return new org.eclipse.aether.repository.Proxy(proxy.getProtocol(),
proxy.getHost(), proxy.getPort(), authentication);
}
代码示例来源:origin: io.tesla.aether.test/aether-test-harness
protected RemoteRepository repositoryConnectingViaProxyWithAuth() {
Authentication auth = new AuthenticationBuilder().addUsername("puser").addPassword("password").build();
Proxy proxy = new Proxy(getHttpProtocol(), "localhost", server.getPort(), auth);
return new RemoteRepository.Builder(repository()).setProxy(proxy).build();
}
代码示例来源:origin: net.oneandone.maven/embedded
private static ProxySelector getProxySelector(Settings settings) {
DefaultProxySelector selector;
AuthenticationBuilder builder;
selector = new DefaultProxySelector();
for (org.apache.maven.settings.Proxy proxy : settings.getProxies()) {
builder = new AuthenticationBuilder();
builder.addUsername(proxy.getUsername()).addPassword(proxy.getPassword());
selector.add(new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(),
proxy.getPort(), builder.build()),
proxy.getNonProxyHosts());
}
return selector;
}
内容来源于网络,如有侵权,请联系作者删除!