import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
import org.apache.archiva.indexer.search.RepositorySearch;
import org.apache.archiva.maven2.metadata.MavenMetadataReader;
+import org.apache.archiva.metadata.repository.storage.RelocationException;
import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.ArtifactReference;
{
return repositoryStorage.getFilePathWithVersion( archivaLocator.getResourcePath(), managedRepositoryContent );
}
- catch ( LayoutException e )
+ catch ( RelocationException e )
{
log.error( e.getMessage(), e );
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
+ throw new BrowserRedirectException( e.getPath() );
}
catch ( XMLException e )
{
String getFilePath( String requestPath, ManagedRepository managedRepository );
String getFilePathWithVersion( final String requestPath, ManagedRepositoryContent managedRepositoryContent )
- throws LayoutException, XMLException;
+ throws RelocationException, XMLException;
}
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.apache.archiva.metadata.repository.filter.Filter;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
+import org.apache.archiva.metadata.repository.storage.RelocationException;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException;
}
public String getFilePathWithVersion( final String requestPath, ManagedRepositoryContent managedRepositoryContent )
- throws XMLException
+ throws XMLException, RelocationException
{
- if (StringUtils.endsWith( requestPath, METADATA_FILENAME ))
+ if ( StringUtils.endsWith( requestPath, METADATA_FILENAME ) )
{
return getFilePath( requestPath, managedRepositoryContent.getRepository() );
}
artifactReference.getVersion(), "-SNAPSHOT" ) + "-" + timestamp + "-"
+ buildNumber );
+ throw new RelocationException(
+ "/repository/" + managedRepositoryContent.getRepository().getId() +
+ ( StringUtils.startsWith( filePath, "/" ) ? "" : "/" ) + filePath, RelocationException.RelocationType.TEMPORARY );
+
}
return filePath;