1 33 package net.myvietnam.mvncore.web; 34 35 import net.myvietnam.mvncore.MVNCoreConfig; 36 import net.myvietnam.mvncore.web.impl.FileUploadParserServletImpl; 37 import org.apache.commons.logging.Log; 38 import org.apache.commons.logging.LogFactory; 39 40 41 public class FileUploadParserFactory { 42 43 private static Log log = LogFactory.getLog(FileUploadParserFactory.class); 44 45 private static FileUploadParser uploadParser = null; 46 47 50 private FileUploadParserFactory() { 51 } 52 53 public static FileUploadParser getFileUploadParser() { 54 55 if (uploadParser == null) { 56 String uploadParserClassName = MVNCoreConfig.getUploadParserClassName(); 57 try { 58 if (uploadParserClassName.length() > 0) { 59 Class urlResolverClass = Class.forName(uploadParserClassName); 60 uploadParser = (FileUploadParser) urlResolverClass.newInstance(); 61 } 62 } catch (Throwable ex) { 63 log.error("Cannot load FileUploadParser implementation (" + uploadParserClassName + ")", ex); 64 } 65 66 if (uploadParser == null) { 68 uploadParser = new FileUploadParserServletImpl(); 69 } 70 71 log.info("Using FileUploadParser = " + uploadParser); 72 } 73 74 return uploadParser; 75 } 76 77 } 78 | Popular Tags |