DefaultFileItemFactorypublic class DefaultFileItemFactory extends Object implements FileItemFactoryThe default {@link org.apache.tomcat.util.http.fileupload.FileItemFactory}
implementation. This implementation creates
{@link 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") .
|
Fields Summary |
---|
public static final int | DEFAULT_SIZE_THRESHOLDThe default threshold above which uploads will be stored on disk. | private File | repositoryThe directory in which uploaded files will be stored, if stored on disk. | private int | sizeThresholdThe threshold above which uploads will be stored on disk. |
Constructors Summary |
---|
public DefaultFileItemFactory()Constructs an unconfigured instance of this class. The resulting factory
may be configured by calling the appropriate setter methods.
// ----------------------------------------------------------- Constructors
| public DefaultFileItemFactory(int sizeThreshold, File repository)Constructs a preconfigured instance of this class.
this.sizeThreshold = sizeThreshold;
this.repository = repository;
|
Methods Summary |
---|
public FileItem | createItem(java.lang.String fieldName, java.lang.String contentType, boolean isFormField, java.lang.String fileName)Create a new {@link org.apache.tomcat.util.http.fileupload.DefaultFileItem}
instance from the supplied parameters and the local factory
configuration.
return new DefaultFileItem(fieldName, contentType,
isFormField, fileName, sizeThreshold, repository);
| public java.io.File | getRepository()Returns the directory used to temporarily store files that are larger
than the configured size threshold.
return repository;
| public int | getSizeThreshold()Returns the size threshold beyond which files are written directly to
disk. The default value is 1024 bytes.
return sizeThreshold;
| public void | setRepository(java.io.File repository)Sets the directory used to temporarily store files that are larger
than the configured size threshold.
this.repository = repository;
| public void | setSizeThreshold(int sizeThreshold)Sets the size threshold beyond which files are written directly to disk.
this.sizeThreshold = sizeThreshold;
|
|