/** * Override Xwork method so we cn use an arbitrary config file * * @see com.opensymphony.xwork.config.providers.XmlConfigurationProvider#getInputStream(java.lang.String) */ protected InputStream getInputStream(String fileName) { InputStream is = null; if (LOG.isDebugEnabled()) LOG.debug("fileName=" + this.basePathString + fileName); try { is = new FileInputStream(this.basePathString + fileName); } catch (FileNotFoundException e) { // ok, try to check the ClassLoader is = FileManager.loadFile(fileName, this.getClass()); } return is; } }
/** * Load the settings from the /freemarker.properties file on the classpath * * @see freemarker.template.Configuration#setSettings for the definition of valid settings */ protected void loadSettings(ServletContext servletContext, freemarker.template.Configuration configuration) { try { InputStream in = FileManager.loadFile("freemarker.properties", FreemarkerManager.class); if (in != null) { Properties p = new Properties(); p.load(in); configuration.setSettings(p); } } catch (IOException e) { log.error("Error while loading freemarker settings from /freemarker.properties", e); } catch (TemplateException e) { log.error("Error while loading freemarker settings from /freemarker.properties", e); } }