public class NettyUploadDiskFileItemFactory extends Object implements org.apache.commons.fileupload.FileItemFactory
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_SIZE_THRESHOLD
The default threshold above which uploads will be stored on disk.
|
static ThreadLocal<String> |
UID |
| 构造器和说明 |
|---|
NettyUploadDiskFileItemFactory()
Constructs an unconfigured instance of this class.
|
NettyUploadDiskFileItemFactory(int sizeThreshold,
File repository)
Constructs a preconfigured instance of this class.
|
| 限定符和类型 | 方法和说明 |
|---|---|
org.apache.commons.fileupload.FileItem |
createItem(String fieldName,
String contentType,
boolean isFormField,
String fileName)
Create a new
DiskFileItem
instance from the supplied parameters and the local factory
configuration. |
org.apache.commons.io.FileCleaningTracker |
getFileCleaningTracker()
Returns the tracker, which is responsible for deleting temporary
files.
|
File |
getRepository()
Returns the directory used to temporarily store files that are larger
than the configured size threshold.
|
int |
getSizeThreshold()
Returns the size threshold beyond which files are written directly to
disk.
|
ThreadLocal<String> |
getUID() |
void |
setFileCleaningTracker(org.apache.commons.io.FileCleaningTracker pTracker)
Sets the tracker, which is responsible for deleting temporary
files.
|
void |
setRepository(File repository)
Sets the directory used to temporarily store files that are larger
than the configured size threshold.
|
void |
setSizeThreshold(int sizeThreshold)
Sets the size threshold beyond which files are written directly to disk.
|
public static ThreadLocal<String> UID
public static final int DEFAULT_SIZE_THRESHOLD
public NettyUploadDiskFileItemFactory()
public NettyUploadDiskFileItemFactory(int sizeThreshold,
File repository)
sizeThreshold - The threshold, in bytes, below which items will be
retained in memory and above which they will be
stored as a file.repository - The data repository, which is the directory in
which files will be created, should the item size
exceed the threshold.public File getRepository()
setRepository(File)public void setRepository(File repository)
repository - The directory in which temporary files will be located.getRepository()public int getSizeThreshold()
setSizeThreshold(int)public void setSizeThreshold(int sizeThreshold)
sizeThreshold - The size threshold, in bytes.getSizeThreshold()public org.apache.commons.fileupload.FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName)
DiskFileItem
instance from the supplied parameters and the local factory
configuration.createItem 在接口中 org.apache.commons.fileupload.FileItemFactoryfieldName - The name of the form field.contentType - The content type of the form field.isFormField - true if this is a plain form field;
false otherwise.fileName - The name of the uploaded file, if any, as supplied
by the browser or other client.public ThreadLocal<String> getUID()
public org.apache.commons.io.FileCleaningTracker getFileCleaningTracker()
FileCleaningTracker, or null
(default), if temporary files aren't tracked.public void setFileCleaningTracker(org.apache.commons.io.FileCleaningTracker pTracker)
pTracker - An instance of FileCleaningTracker,
which will from now on track the created files, or null
(default), to disable tracking.Copyright © 2020. All rights reserved.