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();
}
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 )
{
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 );
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(
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(
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(
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" );
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
+ expect( request.getContextPath() ).andReturn( "" ).times( 2 );
+
archivaConfigurationControl.replay();
repoContentFactoryControl.replay();
requestControl.replay();
expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );
+ expect( request.getContextPath() ).andReturn( "" ).times( 2 );
+
archivaConfigurationControl.replay();
repoContentFactoryControl.replay();
requestControl.replay();