1 16 package net.myvietnam.mvncore.web.fileupload; 17 18 import java.io.File ; 19 import java.util.List ; 20 import javax.servlet.http.HttpServletRequest ; 21 22 48 public class DiskFileUpload 49 extends FileUploadBase { 50 51 53 54 57 private DefaultFileItemFactory fileItemFactory; 58 59 60 62 63 71 public DiskFileUpload() { 72 super(); 73 this.fileItemFactory = new DefaultFileItemFactory(); 74 } 75 76 77 85 public DiskFileUpload(DefaultFileItemFactory fileItemFactory) { 86 super(); 87 this.fileItemFactory = fileItemFactory; 88 } 89 90 91 93 94 101 public FileItemFactory getFileItemFactory() { 102 return fileItemFactory; 103 } 104 105 106 115 public void setFileItemFactory(FileItemFactory factory) { 116 this.fileItemFactory = (DefaultFileItemFactory) factory; 117 } 118 119 120 130 public int getSizeThreshold() { 131 return fileItemFactory.getSizeThreshold(); 132 } 133 134 135 144 public void setSizeThreshold(int sizeThreshold) { 145 fileItemFactory.setSizeThreshold(sizeThreshold); 146 } 147 148 149 159 public String getRepositoryPath() { 160 return fileItemFactory.getRepository().getPath(); 161 } 162 163 164 174 public void setRepositoryPath(String repositoryPath) { 175 fileItemFactory.setRepository(new File (repositoryPath)); 176 } 177 178 179 181 182 200 public List parseRequest(HttpServletRequest req, 201 int sizeThreshold, 202 long sizeMax, String path) 203 throws FileUploadException { 204 setSizeThreshold(sizeThreshold); 205 setSizeMax(sizeMax); 206 setRepositoryPath(path); 207 return parseRequest(req); 208 } 209 210 } 211 | Popular Tags |