1 17 18 19 package org.apache.tomcat.util.http.fileupload; 20 21 22 import java.io.File ; 23 import java.util.List ; 24 import javax.servlet.http.HttpServletRequest ; 25 26 27 50 public class DiskFileUpload 51 extends FileUploadBase 52 { 53 54 56 57 60 private DefaultFileItemFactory fileItemFactory; 61 62 63 65 66 72 public DiskFileUpload() 73 { 74 super(); 75 this.fileItemFactory = new DefaultFileItemFactory(); 76 } 77 78 79 85 public DiskFileUpload(DefaultFileItemFactory fileItemFactory) 86 { 87 super(); 88 this.fileItemFactory = fileItemFactory; 89 } 90 91 92 94 95 100 public FileItemFactory getFileItemFactory() 101 { 102 return fileItemFactory; 103 } 104 105 106 113 public void setFileItemFactory(FileItemFactory factory) 114 { 115 this.fileItemFactory = (DefaultFileItemFactory) factory; 116 } 117 118 119 127 public int getSizeThreshold() 128 { 129 return fileItemFactory.getSizeThreshold(); 130 } 131 132 133 140 public void setSizeThreshold(int sizeThreshold) 141 { 142 fileItemFactory.setSizeThreshold(sizeThreshold); 143 } 144 145 146 154 public String getRepositoryPath() 155 { 156 return fileItemFactory.getRepository().getPath(); 157 } 158 159 160 168 public void setRepositoryPath(String repositoryPath) 169 { 170 fileItemFactory.setRepository(new File (repositoryPath)); 171 } 172 173 174 176 177 193 public List parseRequest(HttpServletRequest req, 194 int sizeThreshold, 195 long sizeMax, String path) 196 throws FileUploadException 197 { 198 setSizeThreshold(sizeThreshold); 199 setSizeMax(sizeMax); 200 setRepositoryPath(path); 201 return parseRequest(req); 202 } 203 204 } 205 | Popular Tags |