/** * Configure the Grizzly HTTP FileCache mechanism */ protected FileCache configureHttpFileCache(org.glassfish.grizzly.config.dom.FileCache cache) { final FileCache fileCache = new FileCache(); if (cache != null) { fileCache.setEnabled(GrizzlyConfig.toBoolean(cache.getEnabled())); fileCache.setSecondsMaxAge(Integer.parseInt(cache.getMaxAgeSeconds())); fileCache.setMaxCacheEntries(Integer.parseInt(cache.getMaxFilesCount())); fileCache.setMaxLargeFileCacheSize(Integer.parseInt(cache.getMaxCacheSizeBytes())); } else { fileCache.setEnabled(false); } return fileCache; }
private void createFileCache(Http h) throws PropertyVetoException { while (true) { try { if (parser.next() == START_ELEMENT) { if (parser.getLocalName().equals("file-cache") && h != null) { FileCache fc = h.createChild(FileCache.class); h.setFileCache(fc); for (int i = 0; i < parser.getAttributeCount(); i++) { String attr = parser.getAttributeLocalName(i); String val = parser.getAttributeValue(i); if (attr.equals("enabled")) { fc.setEnabled(val); } } break; } } } catch (TransactionFailure ex) { logger.log( Level.SEVERE, failureCreatingFileCacheConfig, ex); } catch (XMLStreamException ex) { logger.log( Level.SEVERE, problemParsingFileCacheElement, ex); } } }
/** * Configure the Grizzly HTTP FileCache mechanism */ protected FileCache configureHttpFileCache(org.glassfish.grizzly.config.dom.FileCache cache) { final FileCache fileCache = new FileCache(); if (cache != null) { fileCache.setEnabled(GrizzlyConfig.toBoolean(cache.getEnabled())); fileCache.setSecondsMaxAge(Integer.parseInt(cache.getMaxAgeSeconds())); fileCache.setMaxCacheEntries(Integer.parseInt(cache.getMaxFilesCount())); fileCache.setMaxLargeFileCacheSize(Integer.parseInt(cache.getMaxCacheSizeBytes())); } else { fileCache.setEnabled(false); } return fileCache; }