aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-12-09 11:22:02 +0000
committerOlivier Lamy <olamy@apache.org>2013-12-09 11:22:02 +0000
commit3f90ad3744ae501d1786306529803e1e05aa0536 (patch)
tree879cc62ba6a5724963182fce52492a16d764a223 /archiva-modules
parent4b7ba850f4a881e9429d334647504e4df73b26d7 (diff)
downloadarchiva-3f90ad3744ae501d1786306529803e1e05aa0536.tar.gz
archiva-3f90ad3744ae501d1786306529803e1e05aa0536.zip
finally use a relocation for MRM-1761
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549548 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java5
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java2
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java9
4 files changed, 11 insertions, 6 deletions
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
index cb9d4ace9..ab414f5ca 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/mock/MockBeanServices.java
@@ -154,7 +154,6 @@ public class MockBeanServices
@Override
public String getFilePathWithVersion( String requestPath, ManagedRepositoryContent managedRepositoryContent )
- throws LayoutException, XMLException
{
return null;
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
index 6132dfe01..22966878c 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
@@ -39,6 +39,7 @@ import org.apache.archiva.indexer.merger.IndexMergerRequest;
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;
@@ -537,10 +538,10 @@ public class ArchivaDavResourceFactory
{
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 )
{
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
index fee01b775..b8769ab4f 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
@@ -74,7 +74,7 @@ public interface RepositoryStorage
String getFilePath( String requestPath, ManagedRepository managedRepository );
String getFilePathWithVersion( final String requestPath, ManagedRepositoryContent managedRepositoryContent )
- throws LayoutException, XMLException;
+ throws RelocationException, XMLException;
}
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
index a5e69850b..94cfd4302 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
@@ -38,6 +38,7 @@ import org.apache.archiva.metadata.model.ProjectVersionMetadata;
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;
@@ -765,10 +766,10 @@ public class Maven2RepositoryStorage
}
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() );
}
@@ -811,6 +812,10 @@ public class Maven2RepositoryStorage
artifactReference.getVersion(), "-SNAPSHOT" ) + "-" + timestamp + "-"
+ buildNumber );
+ throw new RelocationException(
+ "/repository/" + managedRepositoryContent.getRepository().getId() +
+ ( StringUtils.startsWith( filePath, "/" ) ? "" : "/" ) + filePath, RelocationException.RelocationType.TEMPORARY );
+
}
return filePath;