Package org.eclipse.jetty.server
Class CachedContentFactory
- java.lang.Object
- 
- org.eclipse.jetty.server.CachedContentFactory
 
- 
- All Implemented Interfaces:
- HttpContent.ContentFactory
 
 public class CachedContentFactory extends java.lang.Object implements HttpContent.ContentFactory 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classCachedContentFactory.CachedHttpContentMetaData associated with a context Resource.classCachedContentFactory.CachedPrecompressedHttpContent
 - 
Constructor SummaryConstructors Constructor Description CachedContentFactory(CachedContentFactory parent, ResourceFactory factory, MimeTypes mimeTypes, boolean useFileMappedBuffer, boolean etags, CompressedContentFormat[] precompressedFormats)Constructor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidflushCache()intgetCachedFiles()intgetCachedSize()HttpContentgetContent(java.lang.String pathInContext, int maxBufferSize)Returns an entry from the cache, or creates a new one.protected java.nio.ByteBuffergetDirectBuffer(Resource resource)protected java.nio.ByteBuffergetIndirectBuffer(Resource resource)protected java.nio.ByteBuffergetMappedBuffer(Resource resource)intgetMaxCachedFiles()intgetMaxCachedFileSize()intgetMaxCacheSize()protected booleanisCacheable(Resource resource)booleanisUseFileMappedBuffer()HttpContentlookup(java.lang.String pathInContext)Deprecated.voidsetMaxCachedFiles(int maxCachedFiles)voidsetMaxCachedFileSize(int maxCachedFileSize)voidsetMaxCacheSize(int maxCacheSize)java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
CachedContentFactorypublic CachedContentFactory(CachedContentFactory parent, ResourceFactory factory, MimeTypes mimeTypes, boolean useFileMappedBuffer, boolean etags, CompressedContentFormat[] precompressedFormats) Constructor.- Parameters:
- parent- the parent resource cache
- factory- the resource factory
- mimeTypes- Mimetype to use for meta data
- useFileMappedBuffer- true to file memory mapped buffers
- etags- true to support etags
- precompressedFormats- array of precompression formats to support
 
 
- 
 - 
Method Detail- 
getCachedSizepublic int getCachedSize() 
 - 
getCachedFilespublic int getCachedFiles() 
 - 
getMaxCachedFileSizepublic int getMaxCachedFileSize() 
 - 
setMaxCachedFileSizepublic void setMaxCachedFileSize(int maxCachedFileSize) 
 - 
getMaxCacheSizepublic int getMaxCacheSize() 
 - 
setMaxCacheSizepublic void setMaxCacheSize(int maxCacheSize) 
 - 
getMaxCachedFilespublic int getMaxCachedFiles() - Returns:
- the max number of cached files.
 
 - 
setMaxCachedFilespublic void setMaxCachedFiles(int maxCachedFiles) - Parameters:
- maxCachedFiles- the max number of cached files.
 
 - 
isUseFileMappedBufferpublic boolean isUseFileMappedBuffer() 
 - 
flushCachepublic void flushCache() 
 - 
lookup@Deprecated public HttpContent lookup(java.lang.String pathInContext) throws java.io.IOException Deprecated.- Throws:
- java.io.IOException
 
 - 
getContentpublic HttpContent getContent(java.lang.String pathInContext, int maxBufferSize) throws java.io.IOException Returns an entry from the cache, or creates a new one. - Specified by:
- getContentin interface- HttpContent.ContentFactory
- Parameters:
- pathInContext- The key into the cache
- maxBufferSize- The maximum buffer size allocated for this request. For cached content, a larger buffer may have previously been allocated and returned by the- HttpContent.getDirectBuffer()or- HttpContent.getIndirectBuffer()calls.
- Returns:
- The entry matching pathInContext, or a new entry if no matching entry was found. If the content exists but is not cacheable, then aResourceHttpContentinstance is returned. If the resource does not exist, then null is returned.
- Throws:
- java.io.IOException- if the resource cannot be retrieved
 
 - 
isCacheableprotected boolean isCacheable(Resource resource) - Parameters:
- resource- the resource to test
- Returns:
- whether the resource is cacheable. The default implementation tests the cache sizes.
 
 - 
getIndirectBufferprotected java.nio.ByteBuffer getIndirectBuffer(Resource resource) 
 - 
getMappedBufferprotected java.nio.ByteBuffer getMappedBuffer(Resource resource) 
 - 
getDirectBufferprotected java.nio.ByteBuffer getDirectBuffer(Resource resource) 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-