📄 jahiaprivatesettings.java
字号:
db_password = properties.getProperty ("db_password").trim (); db_min_connections = Integer.parseInt (properties.getProperty ("db_min_connections").trim ()); db_max_connections = Integer.parseInt (properties.getProperty ("db_max_connections").trim ()); db_waitIfBusy = new Boolean (properties.getProperty ("db_waitIfBusy").trim ()).booleanValue (); db_verbose = new Boolean (properties.getProperty ("db_verbose").trim ()).booleanValue (); // chars encoding utf8Encoding = new Boolean (properties.getProperty ("utf8Encoding").trim ()).booleanValue (); // output cache activation / deactivation if (properties.getProperty ("outputCacheActivated") != null) { outputCacheActivated = new Boolean (properties.getProperty ("outputCacheActivated").trim ()).booleanValue (); } else { // hardcoded default value outputCacheActivated = true; } // output cache expiration delay outputCacheDefaultExpirationDelay = Integer.parseInt ( properties.getProperty("outputCacheDefaultExpirationDelay")); // read the request and output cache sizes outputCacheSize = Integer.parseInt ( properties.getProperty("webappOutputCacheSize")); requestCacheSize = Integer.parseInt ( properties.getProperty("webappRequestCacheSize")); // activation / deactivation of site ID in URL if (properties.getProperty ("siteIDInURL") != null) { siteIDInURL = new Boolean (properties.getProperty ("siteIDInURL").trim ()).booleanValue (); } else { // hardcoded default value siteIDInURL = false; } // activation / deactivation of site ID in URL if (properties.getProperty ("webapps.dispatcher.debug") != null) { appDebugModeOn = new Boolean (properties.getProperty ("webapps.dispatcher.debug").trim ()).booleanValue (); } else { // hardcoded default value appDebugModeOn = false; } // Flag that indicates whether applications can inherit from Jahia session // attributes. if (properties.getProperty ("webapps.dispatcher.inheritJahiaSessionAttributes") != null) { appInheritJahiaSessionAttributes = new Boolean (properties.getProperty ("webapps.dispatcher.inheritJahiaSessionAttributes").trim ()).booleanValue (); } else { // hardcoded default value appInheritJahiaSessionAttributes = false; } // base URL (schema, host, port) to call the web apps deployer service. if (properties.getProperty ("jahiaWebAppsDeployerBaseURL") != null) { jahiaWebAppsDeployerBaseURL = properties.getProperty ("jahiaWebAppsDeployerBaseURL").trim (); } else { // hardcoded default value jahiaWebAppsDeployerBaseURL = "http://127.0.0.1:8080"; } // mail settings... mail_server = properties.getProperty ("mail_server").trim (); mail_administrator = properties.getProperty ("mail_administrator").trim (); mail_from = properties.getProperty ("mail_from").trim (); mail_paranoia = 0; // paranoia settings... String getMailParanoia = properties.getProperty ("mail_paranoia").trim (); if (getMailParanoia.equals ("Standard")) { mail_paranoia = JahiaException.CRITICAL; } else if (getMailParanoia.equals ("Wary")) { mail_paranoia = JahiaException.ERROR; } else if (getMailParanoia.equals ("Paranoid")) { mail_paranoia = JahiaException.WARNING; } // load mime types initDtdEntityResolver (); loadMimeTypes (); } catch (NullPointerException npe) { JahiaConsole.println ("JahiaPrivateSettings", "Properties file is not valid...!"); JahiaConsole.printe ("JahiaPrivateSettings", npe); } catch (NumberFormatException nfe) { JahiaConsole.println ("JahiaPrivateSettings", "Properties file is not valid...!"); JahiaConsole.printe ("JahiaPrivateSettings", nfe); } } // end load /** * Get the principal properties object. * * @return Properties object containing all properties from jahia.properties file. */ public Properties getPropertiesFile () { return this.properties; } // end getPropertiesFile public String getLicenseFileName () { return mLicenseFilename; } /** * A valid URL like http\://127.0.0.1:8080/Jahia * */ public void setJahiaCoreHttpPath (String value) { jahiaCoreHttpPath = value; } /** * Load mime types from web.xml files * * <mime-mapping> * <extension>abs</extension> * <mime-type>audio/x-mpeg</mime-type> * </mime-mapping> * <mime-mapping> * <extension>ai</extension> * <mime-type>application/postscript</mime-type> * </mime-mapping> */ private void loadMimeTypes () { String filepath = this.context.getRealPath ("/WEB-INF/web.xml"); File f = new File (filepath); if (f.exists () && f.canRead ()) { try { MimeTypesFromWebAppXmlFile mtHandler = new MimeTypesFromWebAppXmlFile (f.getAbsolutePath (), mResolver); mimeTypes = mtHandler.getMimeTypes (); } catch (Exception t) { t.printStackTrace (); } } if (mimeTypes == null) mimeTypes = new Properties (); } /** * initiate the Dtd entity resolver we use with local dtd */ private void initDtdEntityResolver () { mResolver = new DtdEntityResolver (); String diskPath = this.jahiaEtcDiskPath + File.separator; // register local DTD //System.out.println(diskPath + JahiaConstants.WEB_DTD_RESOURCE_PATH_22); File resourceFile = new File (diskPath + JahiaConstants.WEB_DTD_RESOURCE_PATH_22); JahiaConsole.println ("JahiaPrivateSettings.initDtdEntityResolver", "Registering resource file : " + resourceFile.toString ()); mResolver.registerDTD (JahiaConstants.WEB_DTD_PUBLICID_22, resourceFile.toString ()); //System.out.println(diskPath + JahiaConstants.WEB_DTD_RESOURCE_PATH_23); resourceFile = new File (diskPath + JahiaConstants.WEB_DTD_RESOURCE_PATH_23); mResolver.registerDTD (JahiaConstants.WEB_DTD_PUBLICID_23, resourceFile.toString ()); //System.out.println(diskPath + JahiaConstants.J2EE_APP_DTD_RESOURCE_PATH_12); resourceFile = new File (diskPath + JahiaConstants.J2EE_APP_DTD_RESOURCE_PATH_12); mResolver.registerDTD (JahiaConstants.J2EE_APP_DTD_PUBLICID_12, resourceFile.toString ()); //System.out.println(diskPath + JahiaConstants.ORION_APP_SERVER_DTD_RESOURCE_PATH); resourceFile = new File (diskPath + JahiaConstants.ORION_APP_SERVER_DTD_RESOURCE_PATH); mResolver.registerDTD (JahiaConstants.ORION_APP_SERVER_DTD_PUBLICID, resourceFile.toString ()); //System.out.println(diskPath + JahiaConstants.ORION_WEB_SITE_DTD_RESOURCE_PATH); resourceFile = new File (diskPath + JahiaConstants.ORION_WEB_SITE_DTD_RESOURCE_PATH); mResolver.registerDTD (JahiaConstants.ORION_WEB_SITE_DTD_PUBLICID, resourceFile.toString ()); } //-------------------------------------------------------------------------- /** * Return the mime types * * @return Properties mimeTypes */ public Properties getMimeTypes () { return mimeTypes; } //-------------------------------------------------------------------------- /** * Return the Dtd entity resolver * * @return EntityResolver */ public EntityResolver getDtdEntityResolver () { return mResolver; } /** * Does Jahia use the Unicode Transformation Format to encode output Strings * * @return True if UTF-8 encoding, false otherwise */ public boolean isUtf8Encoding () { return utf8Encoding; } /** * Return status of cache setting stored in Jahia properties file. * @return true if cache is activated. */ public boolean isOutputCacheActivated () { return outputCacheActivated; } /** * Retrieves the output cache expiration delay, or -1 when no expiration is active. * * @return the output cache expiration delay */ public final int getOutputCacheDefaultExpirationDelay () { return outputCacheDefaultExpirationDelay; } /** * Return status of site ID in URL generation * @return true if the site ID should be generated in all URLs */ public boolean isSiteIDInURL () { return siteIDInURL; } public boolean isAppDebugModeOn () { return appDebugModeOn; } public boolean isAppInheritingJahiaSessionAttributes () { return appInheritJahiaSessionAttributes; } public String getJahiaWebAppsDeployerBaseURL () { return jahiaWebAppsDeployerBaseURL; } public final int getOutputCacheSize () { return outputCacheSize; } public final int getRequestCacheSize () { return requestCacheSize; }} // end JahiaPrivateSettings
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -