]> source.dussan.org Git - archiva.git/commitdiff
configure redirect type temporary or permanently
authorOlivier Lamy <olamy@apache.org>
Mon, 9 Dec 2013 11:22:18 +0000 (11:22 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 9 Dec 2013 11:22:18 +0000 (11:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549550 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java

index 22966878cf5a7e72c8c17b01a3d4c829b4811c02..beb08e2c50eb4d8aa8280d02834478a26cf43029 100644 (file)
@@ -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 )
         {
index 7888b0c7185b36577e2e852bc9856df373c95c46..488a48c2c20c79cc484e8e3346f6bb3569eee63e 100644 (file)
@@ -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;