From ab7ef5c73f417537e81f149702260d5a4c7282ab Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 9 Dec 2013 11:22:18 +0000 Subject: [PATCH] configure redirect type temporary or permanently git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549550 13f79535-47bb-0310-9956-ffa450edef68 --- .../webdav/ArchivaDavResourceFactory.java | 4 ++-- .../archiva/webdav/BrowserRedirectException.java | 16 ++++++++++++++++ 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; -- 2.39.5