mirror of https://github.com/apache/archiva.git
take of NPE, add rest method to cleanup uploaded files in session
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1307830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dbe30a337d
commit
62a08312f9
|
@ -147,7 +147,7 @@ public abstract class AbstractRestService
|
|||
|
||||
protected void triggerAuditEvent( String repositoryId, String filePath, String action )
|
||||
{
|
||||
AuditEvent auditEvent = new AuditEvent();
|
||||
AuditEvent auditEvent = new AuditEvent( action, repositoryId );
|
||||
auditEvent.setAction( action );
|
||||
auditEvent.setRepositoryId( repositoryId );
|
||||
auditEvent.setResource( filePath );
|
||||
|
|
|
@ -187,6 +187,17 @@ public class DefaultFileUploadService
|
|||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public Boolean clearUploadedFiles()
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
List<FileMetadata> fileMetadatas = getSessionFileMetadatas();
|
||||
for ( FileMetadata fileMetadata : fileMetadatas )
|
||||
{
|
||||
deleteFile( fileMetadata.getServerFileName() );
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public List<FileMetadata> getSessionFileMetadatas()
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
|
|
|
@ -75,4 +75,12 @@ public interface FileUploadService
|
|||
@PathParam( "artifactId" ) String artifactId, @QueryParam( "generatePom" ) boolean generatePom )
|
||||
throws ArchivaRestServiceException;
|
||||
|
||||
|
||||
@Path( "clearUploadedFiles" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD )
|
||||
Boolean clearUploadedFiles()
|
||||
throws ArchivaRestServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque
|
|||
this.artifactUploads=[];
|
||||
|
||||
saveArtifacts=function(){
|
||||
|
||||
clearUserMessages();
|
||||
if(!$("#main-content #fileupload" ).valid()){
|
||||
return;
|
||||
}
|
||||
|
@ -55,6 +55,10 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque
|
|||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -66,6 +70,12 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque
|
|||
displayUploadArtifact=function(){
|
||||
var mainContent=$("#main-content");
|
||||
mainContent.html(mediumSpinnerImg());
|
||||
|
||||
|
||||
$.ajax("restServices/archivaUiServices/fileUploadService/clearUploadedFiles", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
mainContent.html($("#file-upload-screen" ).html());
|
||||
$.ajax("restServices/archivaServices/browseService/userRepositories", {
|
||||
type: "GET",
|
||||
|
@ -105,7 +115,8 @@ define("archiva.artifacts-management",["jquery","i18n","order!utils","order!jque
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in New Issue