org.apache.tomcat.util.http.fileupload
public class: DiskFileUpload [javadoc |
source]
java.lang.Object
org.apache.tomcat.util.http.fileupload.FileUploadBase
org.apache.tomcat.util.http.fileupload.DiskFileUpload
High level API for processing file uploads.
This class handles multiple files per single HTML widget, sent using
multipart/mixed
encoding type, as specified by
RFC 1867. Use #parseRequest(HttpServletRequest) to acquire a list of org.apache.tomcat.util.http.fileupload.FileItem s associated with a given HTML
widget.
Individual parts will be stored in temporary disk storage or in memory,
depending on their size, and will be available as org.apache.tomcat.util.http.fileupload.FileItem s.
Methods from org.apache.tomcat.util.http.fileupload.FileUploadBase: |
---|
createItem, getFieldName, getFileItemFactory, getFileName, getHeader, getHeaderEncoding, getSizeMax, isMultipartContent, parseHeaders, parseRequest, setFileItemFactory, setHeaderEncoding, setSizeMax |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.tomcat.util.http.fileupload.DiskFileUpload Detail: |
public FileItemFactory getFileItemFactory() {
return fileItemFactory;
}
Returns the factory class used when creating file items. |
public String getRepositoryPath() {
return fileItemFactory.getRepository().getPath();
}
Returns the location used to temporarily store files that are larger
than the configured size threshold. |
public int getSizeThreshold() {
return fileItemFactory.getSizeThreshold();
}
Returns the size threshold beyond which files are written directly to
disk. |
public List parseRequest(HttpServletRequest req,
int sizeThreshold,
long sizeMax,
String path) throws FileUploadException {
setSizeThreshold(sizeThreshold);
setSizeMax(sizeMax);
setRepositoryPath(path);
return parseRequest(req);
}
Processes an RFC 1867
compliant multipart/form-data stream. If files are stored
on disk, the path is given by getRepository() . |
public void setFileItemFactory(FileItemFactory factory) {
this.fileItemFactory = (DefaultFileItemFactory) factory;
}
Sets the factory class to use when creating file items. The factory must
be an instance of DefaultFileItemFactory or a subclass
thereof, or else a ClassCastException will be thrown. |
public void setRepositoryPath(String repositoryPath) {
fileItemFactory.setRepository(new File(repositoryPath));
}
Sets the location used to temporarily store files that are larger
than the configured size threshold. |
public void setSizeThreshold(int sizeThreshold) {
fileItemFactory.setSizeThreshold(sizeThreshold);
}
Sets the size threshold beyond which files are written directly to disk. |