Bladeren bron

[MRM-1668] download artifacts when coming from search results.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1384563 13f79535-47bb-0310-9956-ffa450edef68
tags/archiva-1.4-M3
Olivier Lamy 11 jaren geleden
bovenliggende
commit
bdb81fef28

+ 17
- 21
archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java Bestand weergeven

@@ -19,7 +19,6 @@ package org.apache.archiva.proxy;
* under the License.
*/

import com.google.common.collect.Lists;
import com.google.common.io.Files;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.NetworkProxy;
@@ -41,6 +40,9 @@ import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.policies.urlcache.UrlFailureCache;
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.archiva.proxy.common.WagonFactoryException;
import org.apache.archiva.redback.components.registry.Registry;
import org.apache.archiva.redback.components.registry.RegistryListener;
import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RemoteRepositoryContent;
import org.apache.archiva.repository.RepositoryContentFactory;
@@ -64,9 +66,6 @@ import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfo;
import org.apache.maven.wagon.repository.Repository;
import org.apache.tools.ant.types.selectors.SelectorUtils;
import org.apache.archiva.redback.components.registry.Registry;
import org.apache.archiva.redback.components.registry.RegistryListener;
import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -90,11 +89,10 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* DefaultRepositoryProxyConnectors
*
*
* @todo exception handling needs work - "not modified" is not really an exceptional case, and it has more layers than
* your average brown onion
*/
@Service( "repositoryProxyConnectors#default" )
@Service ( "repositoryProxyConnectors#default" )
public class DefaultRepositoryProxyConnectors
implements RepositoryProxyConnectors, RegistryListener
{
@@ -104,21 +102,21 @@ public class DefaultRepositoryProxyConnectors
*
*/
@Inject
@Named( value = "archivaConfiguration#default" )
@Named ( value = "archivaConfiguration#default" )
private ArchivaConfiguration archivaConfiguration;

/**
*
*/
@Inject
@Named( value = "repositoryContentFactory#default" )
@Named ( value = "repositoryContentFactory#default" )
private RepositoryContentFactory repositoryFactory;

/**
*
*/
@Inject
@Named( value = "metadataTools#default" )
@Named ( value = "metadataTools#default" )
private MetadataTools metadataTools;

/**
@@ -159,7 +157,7 @@ public class DefaultRepositoryProxyConnectors
*
*/
@Inject
@Named( value = "archivaTaskScheduler#repository" )
@Named ( value = "archivaTaskScheduler#repository" )
private ArchivaTaskScheduler scheduler;

@Inject
@@ -173,7 +171,7 @@ public class DefaultRepositoryProxyConnectors

}

@SuppressWarnings( "unchecked" )
@SuppressWarnings ( "unchecked" )
private void initConnectorsAndNetworkProxies()
{

@@ -444,19 +442,17 @@ public class DefaultRepositoryProxyConnectors
}
catch ( NotFoundException e )
{
if ( log.isDebugEnabled() )
{
log.debug( "Metadata {} not found on remote repository \"{}\".",
Lists.<Object>newArrayList( logicalPath, targetRepository.getRepository().getId() ), e );
}

log.debug( "Metadata {} not found on remote repository '{}'.", logicalPath,
targetRepository.getRepository().getId(), e );

}
catch ( NotModifiedException e )
{
if ( log.isDebugEnabled() )
{
log.debug( "Metadata {} not updated on remote repository \"{}\".",
Lists.<Object>newArrayList( logicalPath, targetRepository.getRepository().getId() ), e );
}

log.debug( "Metadata {} not updated on remote repository '{}'.", logicalPath,
targetRepository.getRepository().getId(), e );

}
catch ( ProxyException e )
{

+ 95
- 84
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java Bestand weergeven

@@ -19,14 +19,14 @@ package org.apache.archiva.rest.api.services;
*/

import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.ArtifactContent;
import org.apache.archiva.rest.api.model.ArtifactContentEntry;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.Entry;
import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.rest.api.model.VersionsList;

import javax.ws.rs.DELETE;
@@ -43,143 +43,154 @@ import java.util.List;
* @author Olivier Lamy
* @since 1.4-M3
*/
@Path( "/browseService/" )
@Path ( "/browseService/" )
public interface BrowseService
{
@Path( "rootGroups" )
@Path ( "rootGroups" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
BrowseResult getRootGroups( @QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
BrowseResult getRootGroups( @QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "browseGroupId/{groupId}" )
@Path ( "browseGroupId/{groupId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
BrowseResult browseGroupId( @PathParam( "groupId" ) String groupId,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
BrowseResult browseGroupId( @PathParam ( "groupId" ) String groupId,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "versionsList/{g}/{a}" )
@Path ( "versionsList/{g}/{a}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
VersionsList getVersionsList( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
VersionsList getVersionsList( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "projectVersionMetadata/{g}/{a}" )
@Path ( "projectVersionMetadata/{g}/{a}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
ProjectVersionMetadata getProjectVersionMetadata( @PathParam( "g" ) String groupId,
@PathParam( "a" ) String artifactId,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
ProjectVersionMetadata getProjectVersionMetadata( @PathParam ( "g" ) String groupId,
@PathParam ( "a" ) String artifactId,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "projectVersionMetadata/{g}/{a}/{v}" )
@Path ( "projectVersionMetadata/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
ProjectVersionMetadata getProjectMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
ProjectVersionMetadata getProjectMetadata( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "userRepositories" )
@Path ( "userRepositories" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
/**
* @return List of managed repositories current user can read
*/
List<ManagedRepository> getUserRepositories()
throws ArchivaRestServiceException;

@Path( "treeEntries/{g}/{a}/{v}" )
@Path ( "treeEntries/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
/**
* return the dependency Tree for an artifacts
* <b>the List result has only one entry</b>
*/
List<TreeEntry> getTreeEntries( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version,
@QueryParam( "repositoryId" ) String repositoryId )
List<TreeEntry> getTreeEntries( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "dependees/{g}/{a}/{v}" )
@Path ( "dependees/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
/**
* List of artifacts using the artifact passed in parameter.
*/
List<Artifact> getDependees( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
List<Artifact> getDependees( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version, @QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "metadatas/{g}/{a}/{v}" )
@Path ( "metadatas/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
List<Entry> getMetadatas( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
List<Entry> getMetadatas( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version, @QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "metadata/{g}/{a}/{v}/{key}/{value}" )
@Path ( "metadata/{g}/{a}/{v}/{key}/{value}" )
@PUT
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
Boolean addMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @PathParam( "key" ) String key,
@PathParam( "value" ) String value, @QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
Boolean addMetadata( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version, @PathParam ( "key" ) String key,
@PathParam ( "value" ) String value, @QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "metadata/{g}/{a}/{v}/{key}" )
@Path ( "metadata/{g}/{a}/{v}/{key}" )
@DELETE
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
Boolean deleteMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @PathParam( "key" ) String key,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
Boolean deleteMetadata( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version, @PathParam ( "key" ) String key,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "artifactContentEntries/{g}/{a}/{v}" )
@Path ( "artifactContentEntries/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
List<ArtifactContentEntry> getArtifactContentEntries( @PathParam( "g" ) String groupId,
@PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version,
@QueryParam( "c" ) String classifier,
@QueryParam( "t" ) String type,
@QueryParam( "p" ) String path,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
List<ArtifactContentEntry> getArtifactContentEntries( @PathParam ( "g" ) String groupId,
@PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version,
@QueryParam ( "c" ) String classifier,
@QueryParam ( "t" ) String type,
@QueryParam ( "p" ) String path,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "artifactDownloadInfos/{g}/{a}/{v}" )
@Path ( "artifactDownloadInfos/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
List<Artifact> getArtifactDownloadInfos( @PathParam( "g" ) String groupId,
@PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version,
@QueryParam( "repositoryId" ) String repositoryId )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
List<Artifact> getArtifactDownloadInfos( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path( "artifactContentText/{g}/{a}/{v}" )
@Path ( "artifactContentText/{g}/{a}/{v}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
/**
* if path is empty content of the file is returned (for pom view)
*/
ArtifactContent getArtifactContentText( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @QueryParam( "c" ) String classifier,
@QueryParam( "t" ) String type, @QueryParam( "p" ) String path,
@QueryParam( "repositoryId" ) String repositoryId )
ArtifactContent getArtifactContentText( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version, @QueryParam ( "c" ) String classifier,
@QueryParam ( "t" ) String type, @QueryParam ( "p" ) String path,
@QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

@Path ( "artifactAvailable/{g}/{a}/{v}" )
@GET
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( noPermission = true, noRestriction = true )
/**
* verify if an artifact is available locally if not download from proxies will be try
* @since 1.4-M3
*/
Boolean artifactAvailable( @PathParam ( "g" ) String groupId, @PathParam ( "a" ) String artifactId,
@PathParam ( "v" ) String version, @QueryParam ( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
}

+ 4
- 0
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml Bestand weergeven

@@ -135,6 +135,10 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-rest-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-proxy</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva.redback</groupId>
<artifactId>redback-rest-services</artifactId>

+ 4
- 0
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java Bestand weergeven

@@ -22,6 +22,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.AuditInformation;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.audit.AuditEvent;
import org.apache.archiva.audit.AuditListener;
import org.apache.archiva.common.utils.VersionUtil;
@@ -77,6 +78,9 @@ public abstract class AbstractRestService
@Inject
protected ArchivaAdministration archivaAdministration;

@Inject
protected ManagedRepositoryAdmin managedRepositoryAdmin;

@Context
protected HttpServletRequest httpServletRequest;


+ 73
- 5
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java Bestand weergeven

@@ -18,8 +18,10 @@ package org.apache.archiva.rest.services;
* under the License.
*/

import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.maven2.model.TreeEntry;
@@ -36,6 +38,7 @@ import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMetadataVersionComparator;
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
import org.apache.archiva.model.ArchivaArtifact;
import org.apache.archiva.proxy.RepositoryProxyConnectors;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContentFactory;
import org.apache.archiva.repository.RepositoryException;
@@ -58,6 +61,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
@@ -91,6 +95,10 @@ public class DefaultBrowseService
@Inject
private RepositoryContentFactory repositoryContentFactory;

@Inject
@Named ( value = "repositoryProxyConnectors#default" )
private RepositoryProxyConnectors connectors;

public BrowseResult getRootGroups( String repositoryId )
throws ArchivaRestServiceException
{
@@ -268,7 +276,7 @@ public class DefaultBrowseService
}
catch ( MetadataResolutionException e )
{
log.error(
log.warn(
"Skipping invalid metadata while compiling shared model for " + groupId + ":" + artifactId
+ " in repo " + repoId + ": " + e.getMessage() );
}
@@ -778,6 +786,70 @@ public class DefaultBrowseService
return new ArtifactContent();
}

public Boolean artifactAvailable( String groupId, String artifactId, String version, String repositoryId )
throws ArchivaRestServiceException
{
List<String> selectedRepos = getSelectedRepos( repositoryId );

try
{
for ( String repoId : selectedRepos )
{

ManagedRepository managedRepository = managedRepositoryAdmin.getManagedRepository( repoId );

boolean snapshot = VersionUtil.isSnapshot( version );

if ( ( snapshot && !managedRepository.isSnapshots() ) || ( !snapshot
&& managedRepository.isSnapshots() ) )
{
continue;
}
ManagedRepositoryContent managedRepositoryContent =
repositoryContentFactory.getManagedRepositoryContent( repoId );
// FIXME default to jar which can be wrong for war zip etc....
ArchivaArtifact archivaArtifact =
new ArchivaArtifact( groupId, artifactId, version, "", "jar", repoId );
File file = managedRepositoryContent.toFile( archivaArtifact );

if ( file != null && file.exists() )
{
return true;
}

String path = managedRepositoryContent.toPath( archivaArtifact );

file = connectors.fetchFromProxies( managedRepositoryContent, path );

if ( file != null && file.exists() )
{
// download pom now
String pomPath = StringUtils.substringBeforeLast( path, ".jar" ) + ".pom";
connectors.fetchFromProxies( managedRepositoryContent, pomPath );
return true;
}
}
}
catch ( RepositoryAdminException e )
{
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
catch ( RepositoryException e )
{
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}

return false;
}

//---------------------------
// internals
//---------------------------

private void closeQuietly( JarFile jarFile )
{
if ( jarFile != null )
@@ -793,10 +865,6 @@ public class DefaultBrowseService
}
}

//---------------------------
// internals
//---------------------------

protected List<ArtifactContentEntry> readFileEntries( File file, String filterPath, String repoId )
throws IOException
{

+ 0
- 3
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java Bestand weergeven

@@ -53,9 +53,6 @@ public class DefaultManagedRepositoriesService
implements ManagedRepositoriesService
{

@Inject
private ManagedRepositoryAdmin managedRepositoryAdmin;

@Inject
private RepositoryCommonValidator repositoryCommonValidator;


+ 28
- 8
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js Bestand weergeven

@@ -329,14 +329,34 @@ function(jquery,ui,sammy,tmpl) {
return;
}
}
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,
function(artifactVersionDetailViewModel){
$("#main-content #"+tabToActivate).tab('show');
if(contentDisplayFn){
contentDisplayFn(groupId,artifactId,version,artifactVersionDetailViewModel);
}
}
);


var artifactAvailableUrl="restServices/archivaServices/browseService/artifactAvailable/"+encodeURIComponent(groupId)+"/"+encodeURIComponent(artifactId);
artifactAvailableUrl+="/"+encodeURIComponent(version);
var selectedRepo=getSelectedBrowsingRepository();
if (selectedRepo){
artifactAvailableUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
}
$("#main-content").html( mediumSpinnerImg());
$.ajax(artifactAvailableUrl, {
type: "GET",
dataType: 'json',
success: function(data) {
// TODO take of the result true or false
//$.log("artifactAvailable:"+data);
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,
function(artifactVersionDetailViewModel){
$("#main-content #"+tabToActivate).tab('show');
if(contentDisplayFn){
contentDisplayFn(groupId,artifactId,version,artifactVersionDetailViewModel);
}
}
);

}
});


};

this.get('#artifact/:groupId/:artifactId/:version',function(context){

Laden…
Annuleren
Opslaan