| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DefaultFileItemFactory | 
 | 
 | 1.0;1 | 
| 1 |  /* | |
| 2 |   * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 |   * contributor license agreements.  See the NOTICE file distributed with | |
| 4 |   * this work for additional information regarding copyright ownership. | |
| 5 |   * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 |   * (the "License"); you may not use this file except in compliance with | |
| 7 |   * the License.  You may obtain a copy of the License at | |
| 8 |   * | |
| 9 |   *      http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 |   * | |
| 11 |   * Unless required by applicable law or agreed to in writing, software | |
| 12 |   * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 |   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 |   * See the License for the specific language governing permissions and | |
| 15 |   * limitations under the License. | |
| 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 |   * | |
| 39 |   * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. | |
| 40 |   */ | |
| 41 | @Deprecated | |
| 42 | public class DefaultFileItemFactory extends DiskFileItemFactory { | |
| 43 | ||
| 44 |      // ----------------------------------------------------------- Constructors | |
| 45 | ||
| 46 |      /** | |
| 47 |       * Constructs an unconfigured instance of this class. The resulting factory | |
| 48 |       * may be configured by calling the appropriate setter methods. | |
| 49 |       * | |
| 50 |       * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. | |
| 51 |       */ | |
| 52 | @Deprecated | |
| 53 |      public DefaultFileItemFactory() { | |
| 54 | 2 |          super(); | 
| 55 | 2 | } | 
| 56 | ||
| 57 |      /** | |
| 58 |       * Constructs a preconfigured instance of this class. | |
| 59 |       * | |
| 60 |       * @param sizeThreshold The threshold, in bytes, below which items will be | |
| 61 |       *                      retained in memory and above which they will be | |
| 62 |       *                      stored as a file. | |
| 63 |       * @param repository    The data repository, which is the directory in | |
| 64 |       *                      which files will be created, should the item size | |
| 65 |       *                      exceed the threshold. | |
| 66 |       * | |
| 67 |       * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. | |
| 68 |       */ | |
| 69 | @Deprecated | |
| 70 | public DefaultFileItemFactory(int sizeThreshold, File repository) { | |
| 71 | 5 |          super(sizeThreshold, repository); | 
| 72 | 5 | } | 
| 73 | ||
| 74 |      // --------------------------------------------------------- Public Methods | |
| 75 | ||
| 76 |      /** | |
| 77 |       * Create a new {@link org.apache.commons.fileupload.DefaultFileItem} | |
| 78 |       * instance from the supplied parameters and the local factory | |
| 79 |       * configuration. | |
| 80 |       * | |
| 81 |       * @param fieldName   The name of the form field. | |
| 82 |       * @param contentType The content type of the form field. | |
| 83 |       * @param isFormField <code>true</code> if this is a plain form field; | |
| 84 |       *                    <code>false</code> otherwise. | |
| 85 |       * @param fileName    The name of the uploaded file, if any, as supplied | |
| 86 |       *                    by the browser or other client. | |
| 87 |       * | |
| 88 |       * @return The newly created file item. | |
| 89 |       * | |
| 90 |       * @deprecated 1.1 Use <code>DiskFileItemFactory</code> instead. | |
| 91 |       */ | |
| 92 | @Override | |
| 93 | @Deprecated | |
| 94 |      public FileItem createItem( | |
| 95 | String fieldName, | |
| 96 | String contentType, | |
| 97 |              boolean isFormField, | |
| 98 | String fileName | |
| 99 |              ) { | |
| 100 | 10 | return new DefaultFileItem(fieldName, contentType, | 
| 101 | 5 | isFormField, fileName, getSizeThreshold(), getRepository()); | 
| 102 | } | |
| 103 | ||
| 104 | } |