1 61 62 63 package org.apache.commons.fileupload; 64 65 import java.io.File ; 66 67 68 90 public class DefaultFileItemFactory implements FileItemFactory 91 { 92 93 95 96 99 public static final int DEFAULT_SIZE_THRESHOLD = 10240; 100 101 102 104 105 108 private File repository; 109 110 111 114 private int sizeThreshold = DEFAULT_SIZE_THRESHOLD; 115 116 117 119 120 124 public DefaultFileItemFactory() 125 { 126 } 127 128 129 139 public DefaultFileItemFactory(int sizeThreshold, File repository) 140 { 141 this.sizeThreshold = sizeThreshold; 142 this.repository = repository; 143 } 144 145 146 148 149 158 public File getRepository() 159 { 160 return repository; 161 } 162 163 164 173 public void setRepository(File repository) 174 { 175 this.repository = repository; 176 } 177 178 179 187 public int getSizeThreshold() 188 { 189 return sizeThreshold; 190 } 191 192 193 201 public void setSizeThreshold(int sizeThreshold) 202 { 203 this.sizeThreshold = sizeThreshold; 204 } 205 206 207 209 223 public FileItem createItem( 224 String fieldName, 225 String contentType, 226 boolean isFormField, 227 String fileName 228 ) 229 { 230 return new DefaultFileItem(fieldName, contentType, 231 isFormField, fileName, sizeThreshold, repository); 232 } 233 234 } 235 | Popular Tags |