Browse Source

[MRM-1861] Proxy behaviour issue migrating from 1.3.x to 2.x

tags/archiva-2.2.1
Eduardo Souza 9 years ago
parent
commit
01f9aad617

+ 1
- 0
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java View File

@@ -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() );

+ 14
- 2
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java View File

@@ -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( "/" );

Loading…
Cancel
Save