public class ResourceCache extends java.lang.Object implements LifeCycle, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
ResourceCache.ResourceMetaData
MetaData associated with a context Resource.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
_cache |
protected int |
_cacheSize |
protected org.mortbay.http.ResourceCache.CachedMetaData |
_leastRecentlyUsed |
protected org.mortbay.http.ResourceCache.CachedMetaData |
_mostRecentlyUsed |
Constructor and Description |
---|
ResourceCache()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy a context.
|
void |
flushCache() |
Resource |
getBaseResource()
Get the base resource.
|
java.lang.String |
getEncodingByMimeType(java.lang.String type)
Get char encoding by mime type.
|
java.util.Map |
getEncodingMap()
Get the map of mime type to char encoding.
|
int |
getMaxCachedFileSize() |
int |
getMaxCacheSize() |
java.lang.String |
getMimeByExtension(java.lang.String filename)
Get the MIME type by filename extension.
|
java.util.Map |
getMimeMap() |
Resource |
getResource(java.lang.String pathInContext)
Get a resource from the context.
|
java.lang.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(java.util.Map encodingMap)
Set the map of mime type to char encoding.
|
void |
setMaxCachedFileSize(int maxCachedFileSize) |
void |
setMaxCacheSize(int maxCacheSize) |
void |
setMimeMap(java.util.Map mimeMap)
Also sets the org.mortbay.http.mimeMap context attribute
|
void |
setMimeMapping(java.lang.String extension,
java.lang.String type)
Set a mime mapping
|
void |
setResourceBase(java.lang.String resourceBase)
Set the Resource Base.
|
void |
setTypeEncoding(java.lang.String mimeType,
java.lang.String encoding)
Set the encoding that should be used for a mimeType.
|
void |
start()
Start the LifeCycle.
|
void |
stop()
Stop the context.
|
protected transient java.util.Map _cache
protected transient int _cacheSize
protected transient org.mortbay.http.ResourceCache.CachedMetaData _mostRecentlyUsed
protected transient org.mortbay.http.ResourceCache.CachedMetaData _leastRecentlyUsed
public java.lang.String getResourceBase()
public void setResourceBase(java.lang.String resourceBase)
resourceBase
- A URL prefix or directory name.public Resource getBaseResource()
public void setBaseResource(Resource base)
base
- The resourceBase as a Resource instancepublic int getMaxCachedFileSize()
public void setMaxCachedFileSize(int maxCachedFileSize)
public int getMaxCacheSize()
public void setMaxCacheSize(int maxCacheSize)
public void flushCache()
public Resource getResource(java.lang.String pathInContext) throws java.io.IOException
pathInContext
- java.io.IOException
public java.util.Map getMimeMap()
public void setMimeMap(java.util.Map mimeMap)
mimeMap
- public java.lang.String getMimeByExtension(java.lang.String filename)
filename
- A file namepublic void setMimeMapping(java.lang.String extension, java.lang.String type)
extension
- type
- public java.util.Map getEncodingMap()
public void setEncodingMap(java.util.Map encodingMap)
encodingMap
- Map of mime type to character encodings.public java.lang.String getEncodingByMimeType(java.lang.String type)
type
- A mime type.public void setTypeEncoding(java.lang.String mimeType, java.lang.String encoding)
mimeType
- encoding
- public void start() throws java.lang.Exception
LifeCycle
public boolean isStarted()
public void stop() throws java.lang.InterruptedException
public void destroy()
public ResourceCache.ResourceMetaData getResourceMetaData(Resource resource)
resource
- Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.