}
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 )
{
* under the License.
*/
+import org.apache.archiva.metadata.repository.storage.RelocationException;
import org.apache.jackrabbit.webdav.DavException;
import javax.servlet.http.HttpServletResponse;
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;