mirror of https://github.com/apache/archiva.git
configure redirect type temporary or permanently
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
06d67e89c9
commit
ab7ef5c73f
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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…
Reference in New Issue