org.apache.tomcat.util.http.fileupload
public class: DefaultFileItemFactory [javadoc |
source]
java.lang.Object
org.apache.tomcat.util.http.fileupload.DefaultFileItemFactory
All Implemented Interfaces:
FileItemFactory
The default org.apache.tomcat.util.http.fileupload.FileItemFactory
implementation. This implementation creates
org.apache.tomcat.util.http.fileupload.FileItem instances which keep their
content either in memory, for smaller items, or in a temporary file on disk,
for larger items. The size threshold, above which content will be stored on
disk, is configurable, as is the directory in which temporary files will be
created.
If not otherwise configured, the default configuration values are as
follows:
- Size threshold is 10KB.
- Repository is the system default temp directory, as returned by
System.getProperty("java.io.tmpdir")
.
Field Summary |
---|
public static final int | DEFAULT_SIZE_THRESHOLD | The default threshold above which uploads will be stored on disk. |
Constructor: |
public DefaultFileItemFactory() {
}
Constructs an unconfigured instance of this class. The resulting factory
may be configured by calling the appropriate setter methods. |
public DefaultFileItemFactory(int sizeThreshold,
File repository) {
this.sizeThreshold = sizeThreshold;
this.repository = repository;
}
Constructs a preconfigured instance of this class. Parameters:
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.
|
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.tomcat.util.http.fileupload.DefaultFileItemFactory Detail: |
public FileItem createItem(String fieldName,
String contentType,
boolean isFormField,
String fileName) {
return new DefaultFileItem(fieldName, contentType,
isFormField, fileName, sizeThreshold, repository);
}
|
public File getRepository() {
return repository;
}
Returns the directory used to temporarily store files that are larger
than the configured size threshold. |
public int getSizeThreshold() {
return sizeThreshold;
}
Returns the size threshold beyond which files are written directly to
disk. The default value is 1024 bytes. |
public void setRepository(File repository) {
this.repository = repository;
}
Sets the directory used to temporarily store files that are larger
than the configured size threshold. |
public void setSizeThreshold(int sizeThreshold) {
this.sizeThreshold = sizeThreshold;
}
Sets the size threshold beyond which files are written directly to disk. |