1 61 62 63 package org.apache.commons.fileupload; 64 65 66 import java.io.File ; 67 import java.util.List ; 68 import javax.servlet.http.HttpServletRequest ; 69 70 71 94 public class DiskFileUpload 95 extends FileUploadBase 96 { 97 98 100 101 104 private DefaultFileItemFactory fileItemFactory; 105 106 107 109 110 116 public DiskFileUpload() 117 { 118 super(); 119 this.fileItemFactory = new DefaultFileItemFactory(); 120 } 121 122 123 129 public DiskFileUpload(DefaultFileItemFactory fileItemFactory) 130 { 131 super(); 132 this.fileItemFactory = fileItemFactory; 133 } 134 135 136 138 139 144 public FileItemFactory getFileItemFactory() 145 { 146 return fileItemFactory; 147 } 148 149 150 157 public void setFileItemFactory(FileItemFactory factory) 158 { 159 this.fileItemFactory = (DefaultFileItemFactory) factory; 160 } 161 162 163 171 public int getSizeThreshold() 172 { 173 return fileItemFactory.getSizeThreshold(); 174 } 175 176 177 184 public void setSizeThreshold(int sizeThreshold) 185 { 186 fileItemFactory.setSizeThreshold(sizeThreshold); 187 } 188 189 190 198 public String getRepositoryPath() 199 { 200 return fileItemFactory.getRepository().getPath(); 201 } 202 203 204 212 public void setRepositoryPath(String repositoryPath) 213 { 214 fileItemFactory.setRepository(new File (repositoryPath)); 215 } 216 217 218 220 221 237 public List parseRequest(HttpServletRequest req, 238 int sizeThreshold, 239 long sizeMax, String path) 240 throws FileUploadException 241 { 242 setSizeThreshold(sizeThreshold); 243 setSizeMax(sizeMax); 244 setRepositoryPath(path); 245 return parseRequest(req); 246 } 247 248 } 249 | Popular Tags |