1 61 62 63 package org.apache.commons.fileupload; 64 65 66 import java.io.File ; 67 import java.util.List ; 68 69 import javax.portlet.ActionRequest; 70 71 72 95 public class PortletDiskFileUpload 96 extends PortletFileUploadBase 97 { 98 99 101 102 105 private DefaultFileItemFactory fileItemFactory; 106 107 108 110 111 117 public PortletDiskFileUpload() 118 { 119 super(); 120 this.fileItemFactory = new DefaultFileItemFactory(); 121 } 122 123 124 130 public PortletDiskFileUpload(DefaultFileItemFactory fileItemFactory) 131 { 132 super(); 133 this.fileItemFactory = fileItemFactory; 134 } 135 136 137 139 140 145 public FileItemFactory getFileItemFactory() 146 { 147 return fileItemFactory; 148 } 149 150 151 158 public void setFileItemFactory(FileItemFactory factory) 159 { 160 this.fileItemFactory = (DefaultFileItemFactory) factory; 161 } 162 163 164 172 public int getSizeThreshold() 173 { 174 return fileItemFactory.getSizeThreshold(); 175 } 176 177 178 185 public void setSizeThreshold(int sizeThreshold) 186 { 187 fileItemFactory.setSizeThreshold(sizeThreshold); 188 } 189 190 191 199 public String getRepositoryPath() 200 { 201 return fileItemFactory.getRepository().getPath(); 202 } 203 204 205 213 public void setRepositoryPath(String repositoryPath) 214 { 215 fileItemFactory.setRepository(new File (repositoryPath)); 216 } 217 218 219 221 222 238 public List parseRequest(ActionRequest req, 239 int sizeThreshold, 240 long sizeMax, String path) 241 throws FileUploadException 242 { 243 setSizeThreshold(sizeThreshold); 244 setSizeMax(sizeMax); 245 setRepositoryPath(path); 246 return parseRequest(req); 247 } 248 249 } 250 | Popular Tags |