1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.fileupload;
18
19 import java.io.File;
20 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
21
22 /**
23 * <p>The default {@link org.apache.commons.fileupload.FileItemFactory}
24 * implementation. This implementation creates
25 * {@link org.apache.commons.fileupload.FileItem} instances which keep their
26 * content either in memory, for smaller items, or in a temporary file on disk,
27 * for larger items. The size threshold, above which content will be stored on
28 * disk, is configurable, as is the directory in which temporary files will be
29 * created.</p>
30 *
31 * <p>If not otherwise configured, the default configuration values are as
32 * follows:
33 * <ul>
34 * <li>Size threshold is 10KB.</li>
35 * <li>Repository is the system default temp directory, as returned by
36 * <code>System.getProperty("java.io.tmpdir")</code>.</li>
37 * </ul>
38 * </p>
39 *
40 * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
41 *
42 * @version $Id: DefaultFileItemFactory.java 479262 2006-11-26 03:09:24Z niallp $
43 *
44 * @deprecated Use <code>DiskFileItemFactory</code> instead.
45 */
46 public class DefaultFileItemFactory extends DiskFileItemFactory {
47
48
49
50
51 /**
52 * Constructs an unconfigured instance of this class. The resulting factory
53 * may be configured by calling the appropriate setter methods.
54 *
55 * @deprecated Use <code>DiskFileItemFactory</code> instead.
56 */
57 public DefaultFileItemFactory() {
58 super();
59 }
60
61
62 /**
63 * Constructs a preconfigured instance of this class.
64 *
65 * @param sizeThreshold The threshold, in bytes, below which items will be
66 * retained in memory and above which they will be
67 * stored as a file.
68 * @param repository The data repository, which is the directory in
69 * which files will be created, should the item size
70 * exceed the threshold.
71 *
72 * @deprecated Use <code>DiskFileItemFactory</code> instead.
73 */
74 public DefaultFileItemFactory(int sizeThreshold, File repository) {
75 super(sizeThreshold, repository);
76 }
77
78
79
80
81 /**
82 * Create a new {@link org.apache.commons.fileupload.DefaultFileItem}
83 * instance from the supplied parameters and the local factory
84 * configuration.
85 *
86 * @param fieldName The name of the form field.
87 * @param contentType The content type of the form field.
88 * @param isFormField <code>true</code> if this is a plain form field;
89 * <code>false</code> otherwise.
90 * @param fileName The name of the uploaded file, if any, as supplied
91 * by the browser or other client.
92 *
93 * @return The newly created file item.
94 *
95 * @deprecated Use <code>DiskFileItemFactory</code> instead.
96 */
97 public FileItem createItem(
98 String fieldName,
99 String contentType,
100 boolean isFormField,
101 String fileName
102 ) {
103 return new DefaultFileItem(fieldName, contentType,
104 isFormField, fileName, getSizeThreshold(), getRepository());
105 }
106
107 }