destroy
public void destroy()
Destroy a context.
Destroy a context and remove it from the HttpServer. The
HttpContext must be stopped before it can be destroyed.
flushCache
public void flushCache()
getBaseResource
public Resource getBaseResource()
Get the base resource.
The base resource is the Resource to use as a relative base
for all context resources. The ResourceBase attribute is a
string version of the baseResource.
- The resourceBase as a Resource instance
getEncodingByMimeType
public String getEncodingByMimeType(String type)
Get char encoding by mime type.
- The prefered character encoding for that type if known.
getEncodingMap
public Map getEncodingMap()
Get the map of mime type to char encoding.
- Map of mime type to character encodings.
getMaxCacheSize
public int getMaxCacheSize()
getMaxCachedFileSize
public int getMaxCachedFileSize()
getMimeByExtension
public String getMimeByExtension(String filename)
Get the MIME type by filename extension.
- MIME type matching the longest dot extension of the
file name.
getMimeMap
public Map getMimeMap()
getResource
public Resource getResource(String pathInContext)
throws IOException
Get a resource from the context.
Cached Resources are returned if the resource fits within the LRU
cache. Directories may have CachedResources returned, but the
caller must use the CachedResource.setCachedData method to set the
formatted directory content.
getResourceBase
public String getResourceBase()
Set the Resource Base.
The base resource is the Resource to use as a relative base
for all context resources. The ResourceBase attribute is a
string version of the baseResource.
If a relative file is passed, it is converted to a file
URL based on the current working directory.
- The file or URL to use as the base for all resources
within the context.
setBaseResource
public void setBaseResource(Resource base)
Set the base resource.
The base resource is the Resource to use as a relative base
for all context resources. The ResourceBase attribute is a
string version of the baseResource.
base
- The resourceBase as a Resource instance
setEncodingMap
public void setEncodingMap(Map encodingMap)
Set the map of mime type to char encoding.
Also sets the org.mortbay.http.encodingMap context attribute
encodingMap
- Map of mime type to character encodings.
setMaxCacheSize
public void setMaxCacheSize(int maxCacheSize)
setMaxCachedFileSize
public void setMaxCachedFileSize(int maxCachedFileSize)
setMimeMap
public void setMimeMap(Map mimeMap)
Also sets the org.mortbay.http.mimeMap context attribute
setMimeMapping
public void setMimeMapping(String extension,
String type)
Set a mime mapping
setResourceBase
public void setResourceBase(String resourceBase)
Set the Resource Base.
The base resource is the Resource to use as a relative base
for all context resources. The ResourceBase attribute is a
string version of the baseResource.
If a relative file is passed, it is converted to a file
URL based on the current working directory.
resourceBase
- A URL prefix or directory name.
setTypeEncoding
public void setTypeEncoding(String mimeType,
String encoding)
Set the encoding that should be used for a mimeType.
stop
public void stop()
throws InterruptedException
Stop the context.
- stop in interface LifeCycle