summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-12-09 11:22:18 +0000
committerOlivier Lamy <olamy@apache.org>2013-12-09 11:22:18 +0000
commitab7ef5c73f417537e81f149702260d5a4c7282ab (patch)
tree625ea4389db9b15e3396c69f4ce5e0066e3108f3 /archiva-modules/archiva-web
parent06d67e89c9290bd767cded678bcaadb0f48fc03a (diff)
downloadarchiva-ab7ef5c73f417537e81f149702260d5a4c7282ab.tar.gz
archiva-ab7ef5c73f417537e81f149702260d5a4c7282ab.zip
configure redirect type temporary or permanently
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549550 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java16
2 files changed, 18 insertions, 2 deletions
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 22966878c..beb08e2c5 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
@@ -540,8 +540,8 @@ public class ArchivaDavResourceFactory
}
catch ( RelocationException e )
{
- log.error( e.getMessage(), e );
- throw new BrowserRedirectException( e.getPath() );
+ log.debug( "Relocation to {}", e.getPath() );
+ throw new BrowserRedirectException( e.getPath(), e.getRelocationType() );
}
catch ( XMLException e )
{
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java
index 7888b0c71..488a48c2c 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java
@@ -19,6 +19,7 @@ package org.apache.archiva.webdav;
* under the License.
*/
+import org.apache.archiva.metadata.repository.storage.RelocationException;
import org.apache.jackrabbit.webdav.DavException;
import javax.servlet.http.HttpServletResponse;
@@ -36,6 +37,21 @@ public class BrowserRedirectException
this.location = location;
}
+ /**
+ *
+ * @param location
+ * @param relocationType see {@link RelocationException.RelocationType}
+ * @since 2.0.0
+ */
+ public BrowserRedirectException( String location, RelocationException.RelocationType relocationType )
+ {
+ super( relocationType == RelocationException.RelocationType.TEMPORARY
+ ? HttpServletResponse.SC_MOVED_TEMPORARILY
+ : HttpServletResponse.SC_MOVED_PERMANENTLY );
+
+ this.location = location;
+ }
+
public String getLocation()
{
return location;