mirror of https://github.com/apache/archiva.git
use a temporary redirect for SNAPSHOT download
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ab7ef5c73f
commit
d1de91d824
|
@ -528,7 +528,7 @@ public class ArchivaDavResourceFactory
|
|||
return path;
|
||||
}
|
||||
|
||||
private String evaluatePathWithVersion( ArchivaDavResourceLocator archivaLocator, ManagedRepositoryContent managedRepositoryContent )
|
||||
private String evaluatePathWithVersion( ArchivaDavResourceLocator archivaLocator, ManagedRepositoryContent managedRepositoryContent, String contextPath )
|
||||
throws DavException
|
||||
{
|
||||
String layout = managedRepositoryContent.getRepository() == null ? new ManagedRepository( ).getLayout() : managedRepositoryContent.getRepository().getLayout();
|
||||
|
@ -540,8 +540,10 @@ public class ArchivaDavResourceFactory
|
|||
}
|
||||
catch ( RelocationException e )
|
||||
{
|
||||
log.debug( "Relocation to {}", e.getPath() );
|
||||
throw new BrowserRedirectException( e.getPath(), e.getRelocationType() );
|
||||
String path = e.getPath();
|
||||
log.debug( "Relocation to {}", path );
|
||||
|
||||
throw new BrowserRedirectException(contextPath + ( StringUtils.startsWith( path, "/" ) ? "": "/" ) + path, e.getRelocationType() );
|
||||
}
|
||||
catch ( XMLException e )
|
||||
{
|
||||
|
@ -559,7 +561,7 @@ public class ArchivaDavResourceFactory
|
|||
if ( isAuthorized( request, managedRepositoryContent.getId() ) )
|
||||
{
|
||||
// Maven Centric part ask evaluation if -SNAPSHOT
|
||||
String path = evaluatePathWithVersion(archivaLocator, managedRepositoryContent);
|
||||
String path = evaluatePathWithVersion(archivaLocator, managedRepositoryContent, request.getContextPath());
|
||||
if ( path.startsWith( "/" ) )
|
||||
{
|
||||
path = path.substring( 1 );
|
||||
|
|
|
@ -240,8 +240,9 @@ public class ArchivaDavResourceFactoryTest
|
|||
|
||||
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
|
||||
|
||||
expect( repoRequest.isSupportFile(
|
||||
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( true );
|
||||
expect( request.getContextPath() ).andReturn( "" ).times( 2 );
|
||||
|
||||
expect( repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( true );
|
||||
|
||||
expect(
|
||||
repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn(
|
||||
|
@ -319,8 +320,9 @@ public class ArchivaDavResourceFactoryTest
|
|||
|
||||
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
|
||||
|
||||
expect( repoRequest.isSupportFile(
|
||||
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false );
|
||||
expect( request.getContextPath() ).andReturn( "" ).times( 2 );
|
||||
|
||||
expect( repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false );
|
||||
|
||||
expect(
|
||||
repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn(
|
||||
|
@ -400,8 +402,9 @@ public class ArchivaDavResourceFactoryTest
|
|||
|
||||
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 4 );
|
||||
|
||||
expect( repoRequest.isSupportFile(
|
||||
"org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false ).times( 2 );
|
||||
expect( request.getContextPath() ).andReturn( "" ).times( 2 );
|
||||
|
||||
expect( repoRequest.isSupportFile( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn( false ).times( 2 );
|
||||
|
||||
expect(
|
||||
repoRequest.isDefault( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ) ).andReturn(
|
||||
|
@ -469,6 +472,8 @@ public class ArchivaDavResourceFactoryTest
|
|||
|
||||
expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 3 );
|
||||
|
||||
expect( request.getContextPath() ).andReturn( "" ).times( 1 );
|
||||
|
||||
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
|
||||
|
||||
expect( request.getRequestURI() ).andReturn( "http://localhost:8080/archiva/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml" );
|
||||
|
@ -530,6 +535,8 @@ public class ArchivaDavResourceFactoryTest
|
|||
|
||||
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
|
||||
|
||||
expect( request.getContextPath() ).andReturn( "" ).times( 2 );
|
||||
|
||||
archivaConfigurationControl.replay();
|
||||
repoContentFactoryControl.replay();
|
||||
requestControl.replay();
|
||||
|
@ -579,6 +586,8 @@ public class ArchivaDavResourceFactoryTest
|
|||
|
||||
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
|
||||
|
||||
expect( request.getContextPath() ).andReturn( "" ).times( 2 );
|
||||
|
||||
archivaConfigurationControl.replay();
|
||||
repoContentFactoryControl.replay();
|
||||
requestControl.replay();
|
||||
|
|
Loading…
Reference in New Issue