From 01f9aad6176656bf6a0bf010c65cd265c87cf62b Mon Sep 17 00:00:00 2001 From: Eduardo Souza Date: Thu, 11 Jun 2015 20:18:45 -0300 Subject: [PATCH] [MRM-1861] Proxy behaviour issue migrating from 1.3.x to 2.x --- .../indexing/DownloadRemoteIndexTask.java | 1 + .../DefaultRemoteRepositoriesService.java | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java index 6a9a39624..f8fd42a24 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java @@ -156,6 +156,7 @@ public class DownloadRemoteIndexTask if ( this.networkProxy != null ) { proxyInfo = new ProxyInfo(); + proxyInfo.setType( this.networkProxy.getProtocol() ); proxyInfo.setHost( this.networkProxy.getHost() ); proxyInfo.setPort( this.networkProxy.getPort() ); proxyInfo.setUserName( this.networkProxy.getUsername() ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java index 64b8043c7..c3528eb4b 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java @@ -34,6 +34,7 @@ import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.providers.http.AbstractHttpClientWagon; import org.apache.maven.wagon.providers.http.HttpConfiguration; import org.apache.maven.wagon.providers.http.HttpMethodConfiguration; +import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; import org.springframework.stereotype.Service; @@ -182,8 +183,19 @@ public class DefaultRemoteRepositoriesService HttpConfiguration httpConfiguration = new HttpConfiguration().setGet( httpMethodConfiguration ); AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration ); } - - wagon.connect( new Repository( remoteRepository.getId(), remoteRepository.getUrl() ) ); + + ProxyInfo proxyInfo = null; + if ( networkProxy != null ) + { + proxyInfo = new ProxyInfo(); + proxyInfo.setType( networkProxy.getProtocol() ); + proxyInfo.setHost( networkProxy.getHost() ); + proxyInfo.setPort( networkProxy.getPort() ); + proxyInfo.setUserName( networkProxy.getUsername() ); + proxyInfo.setPassword( networkProxy.getPassword() ); + } + + wagon.connect( new Repository( remoteRepository.getId(), remoteRepository.getUrl() ), proxyInfo ); // we only check connectivity as remote repo can be empty wagon.getFileList( "/" ); -- 2.39.5