1 16 package net.jforum.util.legacy.commons.fileupload; 17 18 import java.io.File ; 19 import java.util.List ; 20 21 import javax.servlet.http.HttpServletRequest ; 22 23 49 public class DiskFileUpload 50 extends FileUploadBase { 51 52 54 55 58 private DefaultFileItemFactory fileItemFactory; 59 60 61 63 64 72 public DiskFileUpload() { 73 super(); 74 this.fileItemFactory = new DefaultFileItemFactory(); 75 } 76 77 78 86 public DiskFileUpload(DefaultFileItemFactory fileItemFactory) { 87 super(); 88 this.fileItemFactory = fileItemFactory; 89 } 90 91 92 94 95 102 public FileItemFactory getFileItemFactory() { 103 return fileItemFactory; 104 } 105 106 107 116 public void setFileItemFactory(FileItemFactory factory) { 117 this.fileItemFactory = (DefaultFileItemFactory) factory; 118 } 119 120 121 131 public int getSizeThreshold() { 132 return fileItemFactory.getSizeThreshold(); 133 } 134 135 136 145 public void setSizeThreshold(int sizeThreshold) { 146 fileItemFactory.setSizeThreshold(sizeThreshold); 147 } 148 149 150 160 public String getRepositoryPath() { 161 return fileItemFactory.getRepository().getPath(); 162 } 163 164 165 175 public void setRepositoryPath(String repositoryPath) { 176 fileItemFactory.setRepository(new File (repositoryPath)); 177 } 178 179 180 182 183 201 public List parseRequest(HttpServletRequest req, 202 int sizeThreshold, 203 long sizeMax, String path) 204 throws FileUploadException { 205 setSizeThreshold(sizeThreshold); 206 setSizeMax(sizeMax); 207 setRepositoryPath(path); 208 return parseRequest(req); 209 } 210 211 } 212 | Popular Tags |