01: /*
02: * Copyright 2001-2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package net.jforum.util.legacy.commons.fileupload;
17:
18: import javax.servlet.http.HttpServletRequest;
19:
20: /**
21: * <p>High level API for processing file uploads.</p>
22: *
23: * <p>This class handles multiple files per single HTML widget, sent using
24: * <code>multipart/mixed</code> encoding type, as specified by
25: * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link
26: * #parseRequest(HttpServletRequest)} to acquire a list of {@link
27: * org.apache.commons.fileupload.FileItem}s associated with a given HTML
28: * widget.</p>
29: *
30: * <p>How the data for individual parts is stored is determined by the factory
31: * used to create them; a given part may be in memory, on disk, or somewhere
32: * else.</p>
33: *
34: * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
35: * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
36: * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
37: * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
38: * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
39: * @author Sean C. Sullivan
40: *
41: * @version $Id: FileUpload.java,v 1.4 2005/07/26 04:01:16 diegopires Exp $
42: */
43: public class FileUpload extends FileUploadBase {
44:
45: // ----------------------------------------------------------- Data members
46:
47: /**
48: * The factory to use to create new form items.
49: */
50: private FileItemFactory fileItemFactory;
51:
52: // ----------------------------------------------------------- Constructors
53:
54: /**
55: * Constructs an uninitialised instance of this class. A factory must be
56: * configured, using <code>setFileItemFactory()</code>, before attempting
57: * to parse requests.
58: *
59: * @see #FileUpload(FileItemFactory)
60: */
61: public FileUpload() {
62: super ();
63: }
64:
65: /**
66: * Constructs an instance of this class which uses the supplied factory to
67: * create <code>FileItem</code> instances.
68: *
69: * @see #FileUpload()
70: */
71: public FileUpload(FileItemFactory fileItemFactory) {
72: super ();
73: this .fileItemFactory = fileItemFactory;
74: }
75:
76: // ----------------------------------------------------- Property accessors
77:
78: /**
79: * Returns the factory class used when creating file items.
80: *
81: * @return The factory class for new file items.
82: */
83: public FileItemFactory getFileItemFactory() {
84: return fileItemFactory;
85: }
86:
87: /**
88: * Sets the factory class to use when creating file items.
89: *
90: * @param factory The factory class for new file items.
91: */
92: public void setFileItemFactory(FileItemFactory factory) {
93: this.fileItemFactory = factory;
94: }
95:
96: }
|