##### Coverage Report - org.apache.commons.fileupload.FileUpload

Classes in this File | Line Coverage | Branch Coverage | Complexity
FileUpload |
100% | 8/8
N/A | N/A
| 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 |  |
     /**
20 |  |
      * <p>High level API for processing file uploads.</p>
21 |  |
      *
22 |  |
      * <p>This class handles multiple files per single HTML widget, sent using
23 |  |
      * <code>multipart/mixed</code> encoding type, as specified by
24 |  |
      * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>.  Use {@link
25 |  |
      * #parseRequest(RequestContext)} to acquire a list
26 |  |
      * of {@link org.apache.commons.fileupload.FileItem FileItems} associated
27 |  |
      * with a given HTML widget.</p>
28 |  |
      *
29 |  |
      * <p>How the data for individual parts is stored is determined by the factory
30 |  |
      * used to create them; a given part may be in memory, on disk, or somewhere
31 |  |
      * else.</p>
32 |  |
      */
33 |  |
     public class FileUpload
34 |  |
         extends FileUploadBase {
35 |  |
36 |  |
         // ----------------------------------------------------------- Data members
37 |  |
38 |  |
         /**
39 |  |
          * The factory to use to create new form items.
40 |  |
          */
41 |  |
         private FileItemFactory fileItemFactory;
42 |  |
43 |  |
         // ----------------------------------------------------------- Constructors
44 |  |
45 |  |
         /**
46 |  |
          * Constructs an uninitialised instance of this class.
47 |  |
          *
48 |  |
          * A factory must be
49 |  |
          * configured, using <code>setFileItemFactory()</code>, before attempting
50 |  |
          * to parse requests.
51 |  |
          *
52 |  |
          * @see #FileUpload(FileItemFactory)
53 |  |
          */
54 |  |
         public FileUpload() {
55 | 8 |
             super();
56 | 8 |
         }
57 |  |
58 |  |
         /**
59 |  |
          * Constructs an instance of this class which uses the supplied factory to
60 |  |
          * create <code>FileItem</code> instances.
61 |  |
          *
62 |  |
          * @see #FileUpload()
63 |  |
          * @param fileItemFactory The factory to use for creating file items.
64 |  |
          */
65 |  |
         public FileUpload(FileItemFactory fileItemFactory) {
66 | 15 |
             super();
67 | 15 |
             this.fileItemFactory = fileItemFactory;
68 | 15 |
         }
69 |  |
70 |  |
         // ----------------------------------------------------- Property accessors
71 |  |
72 |  |
         /**
73 |  |
          * Returns the factory class used when creating file items.
74 |  |
          *
75 |  |
          * @return The factory class for new file items.
76 |  |
          */
77 |  |
         @Override
78 |  |
         public FileItemFactory getFileItemFactory() {
79 | 30 |
             return fileItemFactory;
80 |  |
         }
81 |  |
82 |  |
         /**
83 |  |
          * Sets the factory class to use when creating file items.
84 |  |
          *
85 |  |
          * @param factory The factory class for new file items.
86 |  |
          */
87 |  |
         @Override
88 |  |
         public void setFileItemFactory(FileItemFactory factory) {
89 | 6 |
             this.fileItemFactory = factory;
90 | 6 |
         }
91 |  |
92 |  |
     }