simple.http.serve
Class CacheContext

java.lang.Object
  extended by simple.http.serve.FileContext
      extended by simple.http.serve.FactoryContext
          extended by simple.http.serve.CacheContext
All Implemented Interfaces:
Context
Direct Known Subclasses:
ExtendedContext

public class CacheContext
extends FactoryContext

The CacheContext object is used to provide a caching implementation of the context. This will ensure that frequent requests for Content objects will hit a cache and thus require less I/O to fulfill the request. The also provides a means to share caching across multiple objects, which share the context. The default maximum cache size is eight kilobytes.

Author:
Niall Gallagher
See Also:
CacheContentFactory

Field Summary
 
Fields inherited from class simple.http.serve.FactoryContext
factory
 
Fields inherited from class simple.http.serve.FileContext
base, format, indexer, locator
 
Constructor Summary
CacheContext()
          Constructor for the CacheContext object.
CacheContext(java.io.File base)
          Constructor for the CacheContext object.
CacheContext(java.io.File base, java.io.File path)
          Constructor for the CacheContext object.
CacheContext(java.io.File base, java.io.File[] list)
          Constructor for the CacheContext object.
CacheContext(java.io.File base, java.io.File[] list, int size)
          Constructor for the CacheContext object.
CacheContext(java.io.File base, int size)
          Constructor for the CacheContext object.
 
Method Summary
 
Methods inherited from class simple.http.serve.FactoryContext
getContent
 
Methods inherited from class simple.http.serve.FileContext
getBasePath, getContentType, getDirectory, getFile, getFormat, getIndex, getLocale, getLocator, getName, getPath, getProperties, getRealPath, getRequestPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheContext

public CacheContext()
Constructor for the CacheContext object. This is used to create a context for the current working directory. This will use a cache that has a default maximum size of eight kilobytes. Also, items remain cached for at most one minute.


CacheContext

public CacheContext(java.io.File base)
Constructor for the CacheContext object. This is used to create a context instance for the specified directory. This will use a cache that has a default maximum size of eight kilobytes. Also, items remain cached for at most one minute.

Parameters:
base - this is the directory specifying the context root

CacheContext

public CacheContext(java.io.File base,
                    int size)
Constructor for the CacheContext object. This is used to create a context instance for the specified directory. This will use a cache that has a default maximum size of eight kilobytes. Also, items remain cached for at most one minute.

Parameters:
base - this is the directory specifying the context root
size - this is the maximum file size that will be cached

CacheContext

public CacheContext(java.io.File base,
                    java.io.File path)
Constructor for the CacheContext object. This is used to create a context instance for the specified directory. This will use a cache that has a default maximum size of eight kilobytes. Also, items remain cached for at most one minute. This will make use of one directory to find configuration.

Parameters:
base - this is the directory specifying the context root
path - this is the directory file used for configuration

CacheContext

public CacheContext(java.io.File base,
                    java.io.File[] list)
Constructor for the CacheContext object. This is used to create a context instance for the specified directory. This will use a cache that has a default maximum size of eight kilobytes. Also, items remain cached for at most one minute. This will make use of the file list to find configuration.

Parameters:
base - this is the directory specifying the context root
list - this is the range of files used for configuration

CacheContext

public CacheContext(java.io.File base,
                    java.io.File[] list,
                    int size)
Constructor for the CacheContext object. This is used to create a context instance for the specified directory. This will use a cache that has a default maximum size of eight kilobytes. Also, items remain cached for at most one minute. This will make use of the file list to find configuration.

Parameters:
base - this is the directory specifying the context root
size - this is the maximum file size that will be cached
list - this is the range of files used for configuration