+ private transient static String _wappname;
+ /**
+ * General properties from the application properties files.
+ */
+ private transient static final Properties _wapprops = new Properties();
+ /**
+ * Siman web application root path on the server.
+ */
+ private transient static String _wapproot;
+ /**
+ * Available template files.
+ */
+ private transient static Map<String, String> _tempfile;
+ /**
+ * List of file extensions mapped to a viewer.
+ */
+ private transient static String[] _viewermap;
+ /**
+ * Available document format converters.
+ */
+ private transient static Map<String, Converter> _convertmap;
+
+ static {
+ synchronized (_wapprops) {
+ // Do common configuration for all users
+
+ _jndprops = new Properties();
+ _tempfile = new HashMap<String, String>();
+ _viewermap = new String[0];
+ _convertmap = new HashMap<String, Converter>();
+
+ ClassLoader cloader = Thread.currentThread()
+ .getContextClassLoader();
+ HttpServletRequest curRequest = ((ServletRequestAttributes) RequestContextHolder
+ .currentRequestAttributes()).getRequest();
+ String appname = curRequest.getContextPath();
+ if (appname.startsWith("/")) {
+ _wappname = appname.substring(1);
+ }
+ // Set local path on the server to the application root.
+ _wapproot = curRequest.getSession().getServletContext()
+ .getRealPath("/");
+
+ try {
+ _jndprops.load(cloader.getResourceAsStream("jndi.properties"));
+ _wapprops.load(cloader.getResourceAsStream(_wappname
+ + ".properties"));
+ } catch (IOException e) {
+ LOG.info(
+ "Can't load application properties: " + e.getMessage(),
+ e);
+ }
+
+ // Configure login security
+ System.setProperty("java.security.auth.login.config", _wapproot
+ + ApplicationSettings.getApplicationProperty("wapp.login"));
+
+ // Customization (must be done after above default settings)
+ File config = new File(_wapproot
+ + getApplicationProperty("wapp.customization"));
+ if (config.exists()) {
+ loadCustomization(config); // Sets default document types, installed modules and available templates
+ } else {
+ LOG.info("Could not find the application configuration file \""
+ + config.getAbsolutePath()
+ + "\", using default settings");
+ }
+ }
+ }