aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-06-13 12:16:24 +0000
committerOlivier Lamy <olamy@apache.org>2012-06-13 12:16:24 +0000
commit235030c2bdc5a4e6218c5137ace6ec982cd9f066 (patch)
tree65aba9f83ea07960e519c366b5973a3c698d9d83 /archiva-modules
parent0db6c1faa2d8410c50c812dea0f62864e4bcdc07 (diff)
downloadarchiva-235030c2bdc5a4e6218c5137ace6ec982cd9f066.tar.gz
archiva-235030c2bdc5a4e6218c5137ace6ec982cd9f066.zip
fix download link in jsp webapp
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1349787 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java34
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/ShowArtifactAction.java1
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp10
4 files changed, 44 insertions, 5 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java
index 027aca7de..9f975e46a 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java
@@ -140,6 +140,17 @@ public class Artifact
*/
private String size;
+ /**
+ * @since 1.4-M3
+ */
+ private String type;
+
+
+ /**
+ * @since 1.4-M3
+ */
+ private String path;
+
public Artifact()
{
@@ -374,6 +385,26 @@ public class Artifact
this.size = size;
}
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath( String path )
+ {
+ this.path = path;
+ }
+
@Override
public String toString()
{
@@ -400,6 +431,9 @@ public class Artifact
sb.append( ", classifier='" ).append( classifier ).append( '\'' );
sb.append( ", packaging='" ).append( packaging ).append( '\'' );
sb.append( ", fileExtension='" ).append( fileExtension ).append( '\'' );
+ sb.append( ", size='" ).append( size ).append( '\'' );
+ sb.append( ", type='" ).append( type ).append( '\'' );
+ sb.append( ", path='" ).append( path ).append( '\'' );
sb.append( '}' );
return sb.toString();
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java
index 8f9f1e1be..4a4065462 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java
@@ -62,7 +62,7 @@ public class ArtifactDownloadInfoBuilder
public Artifact build()
{
ArtifactReference ref = new ArtifactReference();
- ref.setArtifactId( artifactMetadata.getId() );
+ ref.setArtifactId( artifactMetadata.getProject() );
ref.setGroupId( artifactMetadata.getNamespace() );
ref.setVersion( artifactMetadata.getVersion() );
@@ -85,7 +85,9 @@ public class ArtifactDownloadInfoBuilder
artifact.setRepositoryId( artifactMetadata.getRepositoryId() );
artifact.setClassifier( classifier );
artifact.setPackaging( type );
+ artifact.setType( type );
artifact.setFileExtension( extension );
+ artifact.setPath( managedRepositoryContent.toPath( ref ) );
// TODO: find a reusable formatter for this
double s = this.artifactMetadata.getSize();
String symbol = "b";
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/ShowArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/ShowArtifactAction.java
index 363c2de22..5e09669e9 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/ShowArtifactAction.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/ShowArtifactAction.java
@@ -218,6 +218,7 @@ public class ShowArtifactAction
l = new ArrayList<Artifact>();
this.artifacts.put( artifact.getVersion(), l );
}
+
ArtifactDownloadInfoBuilder builder = new ArtifactDownloadInfoBuilder().forArtifactMetadata(
artifact ).withManagedRepositoryContent(
repositoryFactory.getManagedRepositoryContent( repositoryId ) );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
index 25a9c471e..d75477921 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
@@ -171,11 +171,11 @@
<c:set var="packageName">POM</c:set>
</c:when>
<%-- These types aren't usually set in the POM yet, so we fudge them for the well known ones --%>
- <c:when test="${a.type == 'maven-archetype' or a.namespace == 'org.apache.maven.archetypes'}">
+ <c:when test="${a.type == 'maven-archetype' or a.groupId == 'org.apache.maven.archetypes'}">
<c:url var="imageUrl" value="/images/download-type-archetype.png"/>
<c:set var="packageName">Maven Archetype</c:set>
</c:when>
- <c:when test="${a.type == 'maven-skin' or a.namespace == 'org.apache.maven.skins'}">
+ <c:when test="${a.type == 'maven-skin' or a.groupId == 'org.apache.maven.skins'}">
<c:url var="imageUrl" value="/images/download-type-skin.png"/>
<c:set var="packageName">Maven Skin</c:set>
</c:when>
@@ -209,8 +209,10 @@
</c:choose>
<c:url var="url" value="/repository/${a.repositoryId}/${a.path}" />
<tr>
- <td><a href="${url}" title="Download ${a.id}"><img src="${imageUrl}" alt="" width="24" height="24"/></a></td>
- <td class="type"><a href="${url}" title="Download ${a.id}">${packageName}</a></td>
+ <td>
+ <a href="${url}" title="Download ${a.artifactId}"><img src="${imageUrl}" alt="" width="24" height="24"/></a>
+ </td>
+ <td class="type"><a href="${url}" title="Download ${a.artifactId}">${packageName}</a></td>
<td class="size">${a.size}</td>
</tr>
</c:forEach>