MRM-872 first step : don't return first available resource, but list all available, to support "merge" when more than one is present.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas De Loof 2008-07-10 10:14:21 +00:00
parent 0a94a40f00
commit ce121d314f
1 changed files with 93 additions and 81 deletions

View File

@ -191,7 +191,7 @@ public class ArchivaDavResourceFactory
throw new DavException(HttpServletResponse.SC_NO_CONTENT);
}
DavResource resource = null;
List<DavResource> availableResources = new ArrayList<DavResource>();
DavException e = null;
for ( String repositoryId : repositories )
@ -208,6 +208,7 @@ public class ArchivaDavResourceFactory
repositoryId + ">" );
}
DavResource resource = null;
if ( !locator.getResourcePath().startsWith( ArchivaDavResource.HIDDEN_PATH_PREFIX ) )
{
if ( managedRepository != null )
@ -242,15 +243,7 @@ public class ArchivaDavResourceFactory
}
else
{
setHeaders(response, locator, resource );
// compatibility with MRM-440 to ensure browsing the repository works ok
if ( resource.isCollection() && !request.getRequestURI().endsWith("/" ) )
{
throw new BrowserRedirectException( resource.getHref() );
}
resource.addLockManager(lockManager);
return resource;
availableResources.add( resource );
}
}
else
@ -260,7 +253,26 @@ public class ArchivaDavResourceFactory
}
}
throw e;
if (availableResources.isEmpty())
{
throw e;
}
if ( request.getRequestURI().endsWith( "metadata.xml" ) )
{
// TODO MRM-872 : must merge all available metadatas
}
DavResource resource = availableResources.get( 0 );
setHeaders(response, locator, resource );
// compatibility with MRM-440 to ensure browsing the repository works ok
if ( resource.isCollection() && !request.getRequestURI().endsWith("/" ) )
{
throw new BrowserRedirectException( resource.getHref() );
}
resource.addLockManager(lockManager);
return resource;
}
public DavResource createResource( final DavResourceLocator locator, final DavSession davSession )