org.mortbay.http
public class ResourceCache extends Object implements LifeCycle, Serializable
Version: $Id: ResourceCache.java,v 1.14 2007/01/31 17:35:56 janb Exp $
| Nested Class Summary | |
|---|---|
| class | ResourceCache.ResourceMetaData MetaData associated with a context Resource. |
| Field Summary | |
|---|---|
| protected Map | _cache |
| protected int | _cacheSize |
| protected ResourceCache.CachedMetaData | _leastRecentlyUsed |
| protected ResourceCache.CachedMetaData | _mostRecentlyUsed |
| Constructor Summary | |
|---|---|
| ResourceCache() Constructor. | |
| Method Summary | |
|---|---|
| void | destroy() Destroy a context.
|
| void | flushCache() |
| Resource | getBaseResource() Get the base resource.
|
| String | getEncodingByMimeType(String type) Get char encoding by mime type. |
| Map | getEncodingMap() Get the map of mime type to char encoding. |
| int | getMaxCachedFileSize() |
| int | getMaxCacheSize() |
| String | getMimeByExtension(String filename) Get the MIME type by filename extension. |
| Map | getMimeMap() |
| Resource | getResource(String pathInContext) Get a resource from the context.
|
| String | getResourceBase() Set the Resource Base.
|
| ResourceCache.ResourceMetaData | getResourceMetaData(Resource resource) Get Resource MetaData. |
| boolean | isStarted() |
| void | setBaseResource(Resource base) Set the base resource.
|
| void | setEncodingMap(Map encodingMap) Set the map of mime type to char encoding.
|
| void | setMaxCachedFileSize(int maxCachedFileSize) |
| void | setMaxCacheSize(int maxCacheSize) |
| void | setMimeMap(Map mimeMap)
Also sets the org.mortbay.http.mimeMap context attribute |
| void | setMimeMapping(String extension, String type) Set a mime mapping |
| void | setResourceBase(String resourceBase) Set the Resource Base.
|
| void | setTypeEncoding(String mimeType, String encoding) Set the encoding that should be used for a mimeType. |
| void | start() |
| void | stop() Stop the context. |
Returns: The resourceBase as a Resource instance
Parameters: type A mime type.
Returns: The prefered character encoding for that type if known.
Returns: Map of mime type to character encodings.
Parameters: filename A file name
Returns: MIME type matching the longest dot extension of the file name.
Parameters: pathInContext
Returns: Resource
Throws: IOException
Returns: The file or URL to use as the base for all resources within the context.
Parameters: resource
Returns: Meta data for the resource.
Parameters: base The resourceBase as a Resource instance
Parameters: encodingMap Map of mime type to character encodings.
Parameters: mimeMap
Parameters: extension type
Parameters: resourceBase A URL prefix or directory name.
Parameters: mimeType encoding