[MRM-1705] Feature to add custom parameters and/or headers when requesting an external repositories.

correctly use headers.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1401889 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-24 21:14:46 +00:00
parent 45ded60339
commit a51724b013
3 changed files with 18 additions and 13 deletions

View File

@ -705,8 +705,10 @@ public class DefaultRepositoryProxyConnectors
}
wagon = ( networkProxy != null && networkProxy.isUseNtlm() )
? wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol + "-ntlm" ) )
: wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol ) );
? wagonFactory.getWagon( new WagonFactoryRequest( "wagon#" + protocol + "-ntlm",
remoteRepository.getRepository().getExtraHeaders() ) )
: wagonFactory.getWagon( new WagonFactoryRequest( "wagon#" + protocol,
remoteRepository.getRepository().getExtraHeaders() ) );
if ( wagon == null )
{
throw new ProxyException( "Unsupported target repository protocol: " + protocol );

View File

@ -135,8 +135,8 @@ public class DownloadRemoteIndexTask
new URL( this.remoteRepository.getUrl() ).getProtocol() + ( ( this.networkProxy != null
&& this.networkProxy.isUseNtlm() ) ? "-ntlm" : "" );
final StreamWagon wagon =
(StreamWagon) wagonFactory.getWagon( new WagonFactoryRequest().protocol( wagonProtocol ) );
final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon(
new WagonFactoryRequest( wagonProtocol, this.remoteRepository.getExtraHeaders() ) );
int timeoutInMilliseconds = remoteRepository.getTimeout() * 1000;
// FIXME olamy having 2 config values
wagon.setReadTimeout( timeoutInMilliseconds );

View File

@ -238,9 +238,12 @@ public class RepositoryModelResolver
// if it's a ntlm proxy we have to lookup the wagon light which support thats
// wagon http client doesn't support that
wagon = ( networkProxy != null && networkProxy.isUseNtlm() )
? wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol + "-ntlm" ) )
: wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol ) );
wagon = wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#" + protocol ) );
? wagonFactory.getWagon(
new WagonFactoryRequest( "wagon#" + protocol + "-ntlm", remoteRepository.getExtraHeaders() ) )
: wagonFactory.getWagon(
new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
wagon = wagonFactory.getWagon(
new WagonFactoryRequest( "wagon#" + protocol, remoteRepository.getExtraHeaders() ) );
if ( wagon == null )
{
throw new RuntimeException( "Unsupported remote repository protocol: " + protocol );