001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.fileupload;
018    
019    
020    /**
021     * <p>High level API for processing file uploads.</p>
022     *
023     * <p>This class handles multiple files per single HTML widget, sent using
024     * <code>multipart/mixed</code> encoding type, as specified by
025     * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>.  Use {@link
026     * #parseRequest(javax.servlet.http.HttpServletRequest)} to acquire a list
027     * of {@link org.apache.commons.fileupload.FileItem FileItems} associated
028     * with a given HTML widget.</p>
029     *
030     * <p>How the data for individual parts is stored is determined by the factory
031     * used to create them; a given part may be in memory, on disk, or somewhere
032     * else.</p>
033     *
034     * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
035     * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
036     * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
037     * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
038     * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
039     * @author Sean C. Sullivan
040     *
041     * @version $Id: FileUpload.java 479484 2006-11-27 01:06:53Z jochen $
042     */
043    public class FileUpload
044        extends FileUploadBase {
045    
046        // ----------------------------------------------------------- Data members
047    
048    
049        /**
050         * The factory to use to create new form items.
051         */
052        private FileItemFactory fileItemFactory;
053    
054    
055        // ----------------------------------------------------------- Constructors
056    
057    
058        /**
059         * Constructs an uninitialised instance of this class. A factory must be
060         * configured, using <code>setFileItemFactory()</code>, before attempting
061         * to parse requests.
062         *
063         * @see #FileUpload(FileItemFactory)
064         */
065        public FileUpload() {
066            super();
067        }
068    
069    
070        /**
071         * Constructs an instance of this class which uses the supplied factory to
072         * create <code>FileItem</code> instances.
073         *
074         * @see #FileUpload()
075         * @param fileItemFactory The factory to use for creating file items.
076         */
077        public FileUpload(FileItemFactory fileItemFactory) {
078            super();
079            this.fileItemFactory = fileItemFactory;
080        }
081    
082    
083        // ----------------------------------------------------- Property accessors
084    
085    
086        /**
087         * Returns the factory class used when creating file items.
088         *
089         * @return The factory class for new file items.
090         */
091        public FileItemFactory getFileItemFactory() {
092            return fileItemFactory;
093        }
094    
095    
096        /**
097         * Sets the factory class to use when creating file items.
098         *
099         * @param factory The factory class for new file items.
100         */
101        public void setFileItemFactory(FileItemFactory factory) {
102            this.fileItemFactory = factory;
103        }
104    
105    
106    }