You are not logged in. Click here to log in.

codeBeamer Application Lifecycle Management (ALM)

Search In Project

Search inClear

Tags:  not added yet

File Upload Listener


This page is created in order to describe how to add listener into the Listener API which runs after the file uploaded but before it's saved.

public interface FileUploadListener extends EventListener {

     * This method gets called when a new file being uploaded.
     * The {@link BaseEvent#getSource()} is the newly created temporally file
     * @throws VetoException if the listener wishes the upload interrupted.
    void fileUploaded(FileUploadEventData event) throws VetoException;
This feature is designed to post process any uploaded file e.g.: scan for viruses.


The feature is available from codeBeamer version 9.5.0


Please see Listener API, for the Java IDE and dependencies, required to develop and deploy a File Upload Listener.


If the listener finds any problem with the uploaded file,

  • it should throw a com.intland.codebeamer.event.util.VetoException
    • to interrupt the file uploading process, and
    • to delete the uploaded file immediately.
    • The exception message will be shown to the user

Example implementation

The event parameter contains the following information

  • user - the initiator who uploaded the file
  • source - the uploaded

import com.intland.codebeamer.event.FileUploadEventData;
import com.intland.codebeamer.event.FileUploadListener;
import com.intland.codebeamer.event.util.VetoException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;

public class ExampleFileUploadListener implements FileUploadListener {
   private static final Logger logger = Logger.getLogger(ExampleFileUploadListener.class);

   public void fileUploaded(FileUploadEventData event) throws VetoException {"File upload post processing");

      boolean postProcessingResult = doPostProcess(event);

      if(!postProcessingResult) {
          throw new VetoException("Custom error message");

    * Custom file post-processor implementation.
    * @param event - The event data.
    * @return - true if the file is accepted, else false.
   protected boolean doPostProcess(FileUploadEventData event) {
       // custom file post-processor code goes here.