Interface UploadedFileManager

  • All Known Implementing Classes:
    UploadedFileManagerImpl

    @ExperimentalApi
    public interface UploadedFileManager
    Manager for files uploaded through the web. Allows actions to save file in Bamboo home dir. It is responsibility of the users of this manager to remove files that are no longer needed.
    Since:
    4.4
    • Method Detail

      • createFile

        @NotNull
        @NotNull UploadedFile createFile​(@NotNull
                                         @NotNull org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper requestWrapper,
                                         @NotNull
                                         @NotNull String fileParamName)
                                  throws UploadedFileManagerException
        Creates a file on disk. This method ensures that file name on disk is unique.
        Parameters:
        requestWrapper - the wrapper containing getFile() and getFilesystemName() describing the attachment
        fileParamName - name of form parameter specifying filename (in requestWrapper).
        Returns:
        A UploadedFile containing details about whereabouts of the created file
        Throws:
        UploadedFileManagerException - iff file upload fails
      • createFile

        @NotNull
        @NotNull UploadedFile createFile​(@NotNull
                                         @NotNull InputStream inputStream,
                                         @NotNull
                                         @NotNull String fileName,
                                         @NotNull
                                         @NotNull String contentType,
                                         long size)
                                  throws UploadedFileManagerException
        Creates a file on disk. This method ensures that file name on disk is unique.
        Parameters:
        fileName - the source filename
        contentType - the content type of the passed stream
        size - the size of the passed stream.
        Returns:
        A UploadedFile containing details about whereabouts of the created file
        Throws:
        UploadedFileManagerException - iff file upload fails
      • getUploadedFilesDirectory

        @NotNull
        @NotNull File getUploadedFilesDirectory()
        Returns:
        directory in Bamboo home, where uploaded files are stored
      • getMaximumUploadedFileSizeBytes

        long getMaximumUploadedFileSizeBytes()