diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-04-20 20:55:14 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-04-20 20:55:14 +0000 |
commit | d9e4b87d608b07d5f74b58f19cc74d8540a5e2af (patch) | |
tree | 8973c849f5248245b6fe758076d11cd48c238b66 /archiva-web | |
parent | 32f1b4afd229747be65b14fe10f0194b081159fc (diff) | |
download | archiva-d9e4b87d608b07d5f74b58f19cc74d8540a5e2af.tar.gz archiva-d9e4b87d608b07d5f74b58f19cc74d8540a5e2af.zip |
Adding VersionedReference metadata to .fetchFromProxies()
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@530916 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-web')
-rw-r--r-- | archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java index c3e4bfc32..b25daef6a 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java @@ -19,25 +19,19 @@ package org.apache.maven.archiva.web.repository; * under the License. */ -import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.RepositoryConfiguration; -import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.ProjectReference; import org.apache.maven.archiva.model.VersionedReference; -import org.apache.maven.archiva.proxy.ProxyConnector; import org.apache.maven.archiva.proxy.ProxyException; import org.apache.maven.archiva.proxy.RepositoryProxyConnectors; import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory; import org.apache.maven.archiva.repository.layout.LayoutException; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.proxy.ProxyInfo; import org.codehaus.plexus.webdav.AbstractDavServerComponent; import org.codehaus.plexus.webdav.DavServerComponent; import org.codehaus.plexus.webdav.DavServerException; @@ -46,10 +40,6 @@ import org.codehaus.plexus.webdav.util.WebdavMethodUtil; import java.io.File; import java.io.IOException; -import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import javax.servlet.ServletConfig; import javax.servlet.ServletException; @@ -61,8 +51,8 @@ import javax.servlet.http.HttpServletResponse; * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ * @plexus.component role="org.codehaus.plexus.webdav.DavServerComponent" - * role-hint="proxied" - * instantiation-strategy="per-lookup" + * role-hint="proxied" + * instantiation-strategy="per-lookup" */ public class ProxiedDavServer extends AbstractDavServerComponent @@ -93,8 +83,6 @@ public class ProxiedDavServer private ArchivaRepository managedRepository; - private List/*<ArtifactRepository>*/proxiedRepositories; - public String getPrefix() { return davServer.getPrefix(); @@ -120,8 +108,6 @@ public class ProxiedDavServer { davServer.init( servletConfig ); - proxiedRepositories = new ArrayList(); - Configuration config = archivaConfiguration.getConfiguration(); repositoryConfiguration = config.findRepositoryById( getPrefix() ); @@ -156,45 +142,60 @@ public class ProxiedDavServer throws ServletException { String resource = request.getLogicalResource(); - - if( resource.endsWith( ".sha1" ) || - resource.endsWith( ".md5") ) + + if ( resource.endsWith( ".sha1" ) || resource.endsWith( ".md5" ) ) { // Checksums are fetched with artifact / metadata. return; } - + try { ProjectReference project; VersionedReference versioned; ArtifactReference artifact; - - artifact = layout.toArtifactReference( resource ); - if( artifact != null ) + + try { - connectors.fetchFromProxies( managedRepository, artifact ); - return; + artifact = layout.toArtifactReference( resource ); + if ( artifact != null ) + { + connectors.fetchFromProxies( managedRepository, artifact ); + return; + } } - - versioned = layout.toVersionedReference( resource ); - if( versioned != null ) + catch ( LayoutException e ) { - connectors.fetchFromProxies( managedRepository, versioned ); - return; + /* eat it */ } - - project = layout.toProjectReference( resource ); - if( project != null ) + + try { - connectors.fetchFromProxies( managedRepository, project ); - return; + versioned = layout.toVersionedReference( resource ); + if ( versioned != null ) + { + connectors.fetchFromProxies( managedRepository, versioned ); + return; + } + } + catch ( LayoutException e ) + { + /* eat it */ + } + + try + { + project = layout.toProjectReference( resource ); + if ( project != null ) + { + connectors.fetchFromProxies( managedRepository, project ); + return; + } + } + catch ( LayoutException e ) + { + /* eat it */ } - } - catch ( ResourceDoesNotExistException e ) - { - // return an HTTP 404 instead of HTTP 500 error. - return; } catch ( ProxyException e ) { |