Package com.atlassian.bamboo.web.utils
Class UploadedFileManagerImpl
- java.lang.Object
-
- com.atlassian.bamboo.web.utils.UploadedFileManagerImpl
-
- All Implemented Interfaces:
UploadedFileManager
public class UploadedFileManagerImpl extends Object implements UploadedFileManager
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_UPLOADED_FILE_SIZE_MB
-
Constructor Summary
Constructors Constructor Description UploadedFileManagerImpl(BambooHomeLocator homeLocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull UploadedFile
createFile(@NotNull InputStream inputStream, @NotNull String fileName, @NotNull String contentType, long size)
Creates a file on disk.@NotNull UploadedFile
createFile(@NotNull org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper requestWrapper, @NotNull String fileParamName)
Creates a file on disk.long
getMaximumUploadedFileSizeBytes()
@NotNull File
getUploadedFilesDirectory()
void
validateFile(org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper requestWrapper, String fileParamName)
-
-
-
Field Detail
-
DEFAULT_MAX_UPLOADED_FILE_SIZE_MB
public static final int DEFAULT_MAX_UPLOADED_FILE_SIZE_MB
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UploadedFileManagerImpl
public UploadedFileManagerImpl(BambooHomeLocator homeLocator)
-
-
Method Detail
-
createFile
@NotNull public @NotNull UploadedFile createFile(@NotNull @NotNull org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper requestWrapper, @NotNull @NotNull String fileParamName) throws UploadedFileManagerException
Description copied from interface:UploadedFileManager
Creates a file on disk. This method ensures that file name on disk is unique.- Specified by:
createFile
in interfaceUploadedFileManager
- Parameters:
requestWrapper
- the wrapper containing getFile() and getFilesystemName() describing the attachmentfileParamName
- 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 public @NotNull UploadedFile createFile(@NotNull @NotNull InputStream inputStream, @NotNull @NotNull String fileName, @NotNull @NotNull String contentType, long size) throws UploadedFileManagerException
Description copied from interface:UploadedFileManager
Creates a file on disk. This method ensures that file name on disk is unique.- Specified by:
createFile
in interfaceUploadedFileManager
fileName
- the source filenamecontentType
- the content type of the passed streamsize
- the size of the passed stream.- Returns:
- A
UploadedFile
containing details about whereabouts of the created file - Throws:
UploadedFileManagerException
- iff file upload fails
-
getMaximumUploadedFileSizeBytes
public long getMaximumUploadedFileSizeBytes()
- Specified by:
getMaximumUploadedFileSizeBytes
in interfaceUploadedFileManager
-
validateFile
public void validateFile(org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper requestWrapper, String fileParamName) throws UploadedFileManagerException
- Throws:
UploadedFileManagerException
-
getUploadedFilesDirectory
@NotNull public @NotNull File getUploadedFilesDirectory()
- Specified by:
getUploadedFilesDirectory
in interfaceUploadedFileManager
- Returns:
- directory in Bamboo home, where uploaded files are stored
-
-