From fb5386209f4dab341eacb530521428c18d9cfbd4 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 12 Oct 2007 17:58:29 +0000 Subject: [PATCH] Using new ManagedRepositoryContent.toFile( ArchivaArtifact ) git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@584217 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/web/tags/DownloadArtifact.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java index 68d9c445a..7f6fe606f 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java @@ -25,28 +25,21 @@ import com.opensymphony.xwork.util.OgnlValueStack; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.ArchivaConfiguration; -import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.ObjectNotFoundException; import org.apache.maven.archiva.database.constraints.ArtifactsRelatedConstraint; import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.apache.maven.archiva.repository.RepositoryContentFactory; import org.apache.maven.archiva.repository.RepositoryException; import org.apache.maven.archiva.repository.RepositoryNotFoundException; -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.codehaus.plexus.component.repository.exception.ComponentLookupException; import java.io.IOException; import java.io.Writer; import java.text.DecimalFormat; -import java.util.Iterator; import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -76,6 +69,7 @@ public class DownloadArtifact private HttpServletRequest req; + @SuppressWarnings("unused") private HttpServletResponse res; private String groupId; @@ -213,10 +207,8 @@ public class DownloadArtifact sb.append( "

" ); sb.append( "" ); - Iterator it = relatedArtifacts.iterator(); - while ( it.hasNext() ) + for ( ArchivaArtifact artifact : relatedArtifacts ) { - ArchivaArtifact artifact = (ArchivaArtifact) it.next(); sb.append( "\n" ); sb.append( "
" ); @@ -256,13 +248,7 @@ public class DownloadArtifact { StringBuffer url = new StringBuffer(); - ArtifactReference ref = new ArtifactReference(); - ref.setGroupId( artifact.getGroupId() ); - ref.setArtifactId( artifact.getArtifactId() ); - ref.setVersion( artifact.getVersion() ); - ref.setClassifier( artifact.getClassifier() ); - ref.setType( artifact.getType() ); - String path = repo.toPath( ref ); + String path = repo.toPath( artifact ); url.append( prefix ); url.append( "/" ).append( path ); -- 2.39.5