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 */ 017package org.apache.commons.fileupload; 018 019/** 020 * <p>High level API for processing file uploads.</p> 021 * 022 * <p>This class handles multiple files per single HTML widget, sent using 023 * <code>multipart/mixed</code> encoding type, as specified by 024 * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>. Use {@link 025 * #parseRequest(RequestContext)} to acquire a list 026 * of {@link org.apache.commons.fileupload.FileItem FileItems} associated 027 * with a given HTML widget.</p> 028 * 029 * <p>How the data for individual parts is stored is determined by the factory 030 * used to create them; a given part may be in memory, on disk, or somewhere 031 * else.</p> 032 * 033 * @version $Id: FileUpload.java 1454690 2013-03-09 12:08:48Z simonetripodi $ 034 */ 035public class FileUpload 036 extends FileUploadBase { 037 038 // ----------------------------------------------------------- Data members 039 040 /** 041 * The factory to use to create new form items. 042 */ 043 private FileItemFactory fileItemFactory; 044 045 // ----------------------------------------------------------- Constructors 046 047 /** 048 * Constructs an uninitialised instance of this class. 049 * 050 * A factory must be 051 * configured, using <code>setFileItemFactory()</code>, before attempting 052 * to parse requests. 053 * 054 * @see #FileUpload(FileItemFactory) 055 */ 056 public FileUpload() { 057 super(); 058 } 059 060 /** 061 * Constructs an instance of this class which uses the supplied factory to 062 * create <code>FileItem</code> instances. 063 * 064 * @see #FileUpload() 065 * @param fileItemFactory The factory to use for creating file items. 066 */ 067 public FileUpload(FileItemFactory fileItemFactory) { 068 super(); 069 this.fileItemFactory = fileItemFactory; 070 } 071 072 // ----------------------------------------------------- Property accessors 073 074 /** 075 * Returns the factory class used when creating file items. 076 * 077 * @return The factory class for new file items. 078 */ 079 @Override 080 public FileItemFactory getFileItemFactory() { 081 return fileItemFactory; 082 } 083 084 /** 085 * Sets the factory class to use when creating file items. 086 * 087 * @param factory The factory class for new file items. 088 */ 089 @Override 090 public void setFileItemFactory(FileItemFactory factory) { 091 this.fileItemFactory = factory; 092 } 093 094}