@Override
	public void init() throws ServletException{
		//从web.xml读取debug模式。
		debug = (new Boolean(this.getInitParameter("debug"))).booleanValue();
		if(debug){
			logger.debug("\r\n---CKEditorUploadServlet initialization started----");
		}
		//格式化目录和文件命名方式。
		dirFormatter = new SimpleDateFormat("yyyyMMdd");
		fileFormatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
		//从web.xml中获取上传根目录。
		baseDir = this.getInitParameter("baseDir");
		if(baseDir == null || baseDir.isEmpty()){
			baseDir = File.separator + "uploadFiles" + File.separator;;
		}
		if((baseDir.charAt(baseDir.length() - 1) != '/') && (baseDir.charAt(baseDir.length() - 1) != File.separatorChar)){
			baseDir += File.separator;
		}
		if(debug){
			logger.debug("baseDir:"+baseDir);
		}
		//从web.xml
		enabled = (new Boolean(this.getInitParameter("enabled"))).booleanValue();
		String realBaseDir = this.getServletContext().getRealPath(baseDir);
		File baseFile = new File(realBaseDir);
		if(!baseFile.exists()){
			baseFile.mkdirs();
		}
		if(debug){
			logger.debug("realBaseDir:"+realBaseDir);
		}
		//实例化允许的扩展名何阻止的扩展名。
		allowedExtensions = new Hashtable<String,List<String>>();
		deniedExtensions = new Hashtable<String,List<String>>();
		//从web.xml读取配置信息。
		List<String> allowList = this.stringToArrayList(this.getInitParameter("AllowedExtensionsFile"));
		List<String> denyList =this.stringToArrayList(this.getInitParameter("DeniedExtensionsFile"));
		allowedExtensions.put("File", allowList);
		deniedExtensions.put("File", denyList);
		allowedExtensions.put("Image", allowList);
		deniedExtensions.put("Image", denyList);
		allowedExtensions.put("Flash", allowList);
		deniedExtensions.put("Flash", denyList);
		
		if(debug){
			logger.debug("---CKEditorUploadServlet initialization completed---\r\n");
		}
	}