1 package org.apache.turbine.services.upload; 2 3 18 19 import javax.servlet.http.HttpServletRequest ; 20 21 import org.apache.turbine.services.InstantiationException; 22 import org.apache.turbine.services.TurbineServices; 23 import org.apache.turbine.util.TurbineException; 24 import org.apache.turbine.util.parser.ParameterParser; 25 26 38 public abstract class TurbineUpload 39 { 40 46 public static UploadService getService() 47 { 48 return (UploadService) TurbineServices.getInstance(). 49 getService(UploadService.SERVICE_NAME); 50 } 51 52 59 public static boolean isAvailable() 60 { 61 UploadService upload = null; 62 try 63 { 64 upload = getService(); 65 } 66 catch (InstantiationException ie) 67 { 68 return false; 71 } 72 return true; 73 } 74 75 87 public static boolean getAutomatic() 88 { 89 return isAvailable() && getService().getAutomatic(); 91 } 92 93 100 public static long getSizeMax() 101 { 102 return getService().getSizeMax(); 103 } 104 105 111 public static int getSizeThreshold() 112 { 113 return getService().getSizeThreshold(); 114 } 115 116 122 public static String getRepository() 123 { 124 return getService().getRepository(); 125 } 126 127 139 public static void parseRequest(HttpServletRequest req, 140 ParameterParser params) 141 throws TurbineException 142 { 143 UploadService upload = getService(); 144 upload.parseRequest(req, params, upload.getRepository()); 145 } 146 147 161 public static void parseRequest(HttpServletRequest req, 162 ParameterParser params, 163 String path) 164 throws TurbineException 165 { 166 getService().parseRequest(req, params, path); 167 } 168 } 169 | Popular Tags |