String homeDir = System.getProperty("exist.home"); if(homeDir == null) { homeDir = config.getServletContext().getRealPath("/"); System.setProperty("exist.home", homeDir); }
	public void init(ServletConfig config) throws ServletException {		super.init(config);		user = config.getInitParameter("user");		if(user == null)			user = DEFAULT_USER;		password = config.getInitParameter("password");		if(password == null)			password = DEFAULT_PASS;		collectionURI = config.getInitParameter("uri");		if(collectionURI == null)			collectionURI = DEFAULT_URI;		formEncoding = config.getInitParameter("form-encoding");		if(formEncoding == null)			formEncoding = DEFAULT_ENCODING;		log("form-encoding = " + formEncoding);		containerEncoding = config.getInitParameter("container-encoding");		if(containerEncoding == null)			containerEncoding = DEFAULT_ENCODING;		log("container-encoding = " + containerEncoding);		encoding = config.getInitParameter("encoding");		if(encoding == null)			encoding = DEFAULT_ENCODING;		log("encoding = " + encoding);		contentType = config.getInitParameter("content-type");		if(contentType == null)		    contentType = DEFAULT_CONTENT_TYPE;				try {			Class driver = Class.forName(DRIVER);			Database database = (Database)driver.newInstance();			database.setProperty("create-database", "true");			DatabaseManager.registerDatabase(database);		} catch(Exception e) {			throw new ServletException("Failed to initialize database driver: " + e.getMessage(), e);		}				// set exist.home property if not set		String homeDir = System.getProperty("exist.home");		if(homeDir == null) {			homeDir = config.getServletContext().getRealPath("/");			System.setProperty("exist.home", homeDir);		}	}