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.myvietnam.mvncore.web.fileupload;
17:
18: /**
19: * <p>High level API for processing file uploads.</p>
20: *
21: * <p>This class handles multiple files per single HTML widget, sent using
22: * <code>multipart/mixed</code> encoding type, as specified by
23: * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link
24: * #parseRequest(HttpServletRequest)} to acquire a list of {@link
25: * org.apache.commons.fileupload.FileItem}s associated with a given HTML
26: * widget.</p>
27: *
28: * <p>How the data for individual parts is stored is determined by the factory
29: * used to create them; a given part may be in memory, on disk, or somewhere
30: * else.</p>
31: *
32: * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
33: * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
34: * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
35: * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
36: * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
37: * @author Sean C. Sullivan
38: *
39: * @version $Id: FileUpload.java,v 1.2 2006/02/12 04:43:11 minhnn Exp $
40: */
41: public class FileUpload extends FileUploadBase {
42:
43: // ----------------------------------------------------------- Data members
44:
45: /**
46: * The factory to use to create new form items.
47: */
48: private FileItemFactory fileItemFactory;
49:
50: // ----------------------------------------------------------- Constructors
51:
52: /**
53: * Constructs an uninitialised instance of this class. A factory must be
54: * configured, using <code>setFileItemFactory()</code>, before attempting
55: * to parse requests.
56: *
57: * @see #FileUpload(FileItemFactory)
58: */
59: public FileUpload() {
60: super ();
61: }
62:
63: /**
64: * Constructs an instance of this class which uses the supplied factory to
65: * create <code>FileItem</code> instances.
66: *
67: * @see #FileUpload()
68: */
69: public FileUpload(FileItemFactory fileItemFactory) {
70: super ();
71: this .fileItemFactory = fileItemFactory;
72: }
73:
74: // ----------------------------------------------------- Property accessors
75:
76: /**
77: * Returns the factory class used when creating file items.
78: *
79: * @return The factory class for new file items.
80: */
81: public FileItemFactory getFileItemFactory() {
82: return fileItemFactory;
83: }
84:
85: /**
86: * Sets the factory class to use when creating file items.
87: *
88: * @param factory The factory class for new file items.
89: */
90: public void setFileItemFactory(FileItemFactory factory) {
91: this.fileItemFactory = factory;
92: }
93:
94: }
|