public I18nImpl() { // This class is instantiated by the I18nFactoryImpl class during application startup. FacesContext startupFacesContext = FacesContext.getCurrentInstance(); // Store the resource bundle cache in the application map (as a Servlet Context attribute). if (startupFacesContext != null) { ExternalContext externalContext = startupFacesContext.getExternalContext(); Cache<Locale, ResourceBundle> facesResourceBundleCache; int initialCacheCapacity = WebConfigParam.I18nInitialCacheCapacity.getIntegerValue(externalContext); int maxCacheCapacity = WebConfigParam.I18nMaxCacheCapacity.getIntegerValue(externalContext); if (maxCacheCapacity > -1) { facesResourceBundleCache = CacheFactory.getConcurrentLRUCacheInstance(externalContext, initialCacheCapacity, maxCacheCapacity); } else { facesResourceBundleCache = CacheFactory.getConcurrentCacheInstance(externalContext, initialCacheCapacity); } Map<String, Object> applicationMap = externalContext.getApplicationMap(); applicationMap.put(I18nImpl.class.getName(), facesResourceBundleCache); } else { logger.error("Unable to store the resource bundle cache in the application map"); } }
protected String getUploadedFilesFolder(ExternalContext externalContext, String location) { String uploadedFilesDir = null; if ((location != null) && (location.length() > 0)) { uploadedFilesDir = location; } else { MultiPartConfig facesServletMultiPartConfig = getFacesServletMultiPartConfig(externalContext); if (facesServletMultiPartConfig != null) { uploadedFilesDir = facesServletMultiPartConfig.getLocation(); } if (uploadedFilesDir == null) { uploadedFilesDir = WebConfigParam.UploadedFilesDir.getStringValue(externalContext); } } return uploadedFilesDir; } }
boolean resolveEntities = WebConfigParam.ResolveXMLEntities.getBooleanValue(externalContext);
boolean resolveEntities = WebConfigParam.ResolveXMLEntities.getBooleanValue(externalContext);
protected String getUploadedFilesFolder(ExternalContext externalContext, String location) { String uploadedFilesDir = null; if ((location != null) && (location.length() > 0)) { uploadedFilesDir = location; } else { MultiPartConfig facesServletMultiPartConfig = getFacesServletMultiPartConfig(externalContext); if (facesServletMultiPartConfig != null) { uploadedFilesDir = facesServletMultiPartConfig.getLocation(); } if (uploadedFilesDir == null) { uploadedFilesDir = WebConfigParam.UploadedFilesDir.getStringValue(externalContext); } } return uploadedFilesDir; } }
/** * This method initializes the message cache for I18nMap. The initialization cannot be performed in the constructor * since this class is created by {@link UtilELResolver} before the {@link CacheFactory} has been created. */ @Override public void processEvent(SystemEvent systemEvent) throws AbortProcessingException { FacesContext startupFacesContext = FacesContext.getCurrentInstance(); // Store the i18n message cache in the application map (as a Servlet Context attribute). if (startupFacesContext != null) { ExternalContext externalContext = startupFacesContext.getExternalContext(); Map<String, Object> applicationMap = externalContext.getApplicationMap(); Cache<String, String> messageCache; int initialCacheCapacity = WebConfigParam.I18nELMapInitialCacheCapacity.getIntegerValue(externalContext); int maxCacheCapacity = WebConfigParam.I18nELMapMaxCacheCapacity.getIntegerValue(externalContext); if (maxCacheCapacity > -1) { messageCache = CacheFactory.getConcurrentLRUCacheInstance(externalContext, initialCacheCapacity, maxCacheCapacity); } else { messageCache = CacheFactory.getConcurrentCacheInstance(externalContext, initialCacheCapacity); } applicationMap.put(I18nMap.class.getName(), messageCache); } else { logger.error("Unable to store the i18n message cache in the application map"); } }
boolean resolveEntities = WebConfigParam.ResolveXMLEntities.getBooleanValue(initExternalContext);
protected String getUploadedFilesFolder(ExternalContext externalContext, String location) { String uploadedFilesDir = null; if ((location != null) && (location.length() > 0)) { uploadedFilesDir = location; } else { MultiPartConfig facesServletMultiPartConfig = getFacesServletMultiPartConfig(externalContext); if (facesServletMultiPartConfig != null) { uploadedFilesDir = facesServletMultiPartConfig.getLocation(); } if (uploadedFilesDir == null) { uploadedFilesDir = WebConfigParam.UploadedFilesDir.getStringValue(externalContext); } } return uploadedFilesDir; }
int uploadedFileMaxSize = WebConfigParam.UploadedFileMaxSize.getIntegerValue(externalContext);