simple.http.serve
Class ExtendedContext

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

public class ExtendedContext
extends CacheContext

The ExtendedContext object is used to provide a file context that extends another seperate context. This is used so that files from another context are available to this one. Such a configuration has advantages when acquiring templates or files in a server with multiple hosts. It allows a set of stock files, images, and templates to become available to multiple contexts.

Author:
Niall Gallagher
See Also:
CacheContext

Field Summary
protected  Context extend
          The context used if a file is not found in this context.
 
Fields inherited from class simple.http.serve.FactoryContext
factory
 
Fields inherited from class simple.http.serve.FileContext
base, format, indexer, locator
 
Constructor Summary
ExtendedContext(java.io.File base, java.io.File extend)
          Constructor for the ExtendedContext object.
ExtendedContext(java.io.File base, java.io.File extend, java.io.File[] list)
          Constructor for the ExtendedContext object.
 
Method Summary
 Index getIndex(java.lang.String target)
          This method is used to acquire an Index for the URI path provided.
 
Methods inherited from class simple.http.serve.FactoryContext
getContent
 
Methods inherited from class simple.http.serve.FileContext
getBasePath, getContentType, getDirectory, getFile, getFormat, 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
 

Field Detail

extend

protected Context extend
The context used if a file is not found in this context.

Constructor Detail

ExtendedContext

public ExtendedContext(java.io.File base,
                       java.io.File extend)
Constructor for the ExtendedContext object. This is used to create a context that will search the provided base path before the extended directory. This allows a set of stock images, templates, and files to be shared between separate extended context instances in a server with several hosts.

Parameters:
base - this is the directory specifying the context root
extend - this is the directory path that is extended

ExtendedContext

public ExtendedContext(java.io.File base,
                       java.io.File extend,
                       java.io.File[] list)
Constructor for the ExtendedContext object. This is used to create a context that will search the provided base path before the extended directory. This allows a set of stock images, templates, and files to be shared between separate extended context instances in a server with several hosts.

Parameters:
base - this is the directory specifying the context root
extend - this is the directory path that is extended
list - this is the range of files used for configuration
Method Detail

getIndex

public Index getIndex(java.lang.String target)
This method is used to acquire an Index for the URI path provided. The index is first acquired using the base path for this context, if the file does not exist then the extended directory path is used to provide the index. This is done so that files from both directories are visible.

Specified by:
getIndex in interface Context
Overrides:
getIndex in class FileContext
Parameters:
target - this is the URI path referenceing an OS file
Returns:
this returns an index object for the URI target