Browse Source

configure redirect type temporary or permanently

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549550 13f79535-47bb-0310-9956-ffa450edef68
tags/archiva-2.0.0-RC1
Olivier Lamy 10 years ago
parent
commit
ab7ef5c73f

+ 2
- 2
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java View 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 )
{

+ 16
- 0
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/BrowserRedirectException.java View 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;

Loading…
Cancel
Save