1 17 18 19 package org.apache.tomcat.util.http.fileupload; 20 21 import java.io.File ; 22 23 24 46 public class DefaultFileItemFactory implements FileItemFactory 47 { 48 49 51 52 55 public static final int DEFAULT_SIZE_THRESHOLD = 10240; 56 57 58 60 61 64 private File repository; 65 66 67 70 private int sizeThreshold = DEFAULT_SIZE_THRESHOLD; 71 72 73 75 76 80 public DefaultFileItemFactory() 81 { 82 } 83 84 85 95 public DefaultFileItemFactory(int sizeThreshold, File repository) 96 { 97 this.sizeThreshold = sizeThreshold; 98 this.repository = repository; 99 } 100 101 102 104 105 114 public File getRepository() 115 { 116 return repository; 117 } 118 119 120 129 public void setRepository(File repository) 130 { 131 this.repository = repository; 132 } 133 134 135 143 public int getSizeThreshold() 144 { 145 return sizeThreshold; 146 } 147 148 149 157 public void setSizeThreshold(int sizeThreshold) 158 { 159 this.sizeThreshold = sizeThreshold; 160 } 161 162 163 165 179 public FileItem createItem( 180 String fieldName, 181 String contentType, 182 boolean isFormField, 183 String fileName 184 ) 185 { 186 return new DefaultFileItem(fieldName, contentType, 187 isFormField, fileName, sizeThreshold, repository); 188 } 189 190 } 191 | Popular Tags |