Table of Contents

OIL2 Class Standard.URLfileLoader


class Standard . URLfileLoader {
        oid     accessChecker;
        set     defaultFileNames;
        set     directoryRoots;
        string  logicalRoot;
        any     objectClass;
        oid     urlDir;
inherits from Object;

DESCRIPTION

The class URLfileLoader is the default handler for many HTTP server requests. Its role is to load files located on the local file system (e.g, HTML, GIF, JPEG, etc.) that were referenced by HTTP requests.

METHODS


Standard.URLfileLoader:create

URLfileLoader:create(oid urlDirectory, string objClass, string root, oid checker, optional any dirRoots)

Method Description

See initialize.


Standard.URLfileLoader:initialize

URLfileLoader:initialize(oid urlDirectory, any objClass, string root, oid checker, any dirRoots)

Method Description

The initialize method takes three mandatory arguments. The urlDirectory argument specifies the URLdirectory object for the site. The objClass argument specifies the class to be used when creating any cached objects; normally, this is HTTPcachedFile. The root parameter specifies the logical root of the document tree for which the URLfileLoader object will be responsible. If the section of the tree is to be protected from access, the object Id of an URLprotectedFile object is provided as the checker argument; otherwise is is specified as nil. All remaining arguments specified directories in the locally accessible filesystems that should be searched for files.

The URLfileLoader object registers itself as a directory handler by sending the URLdirectory object a registerDirectoryHandler message.

Return Value

Always returns an integer value of zero.


Standard.URLfileLoader:handlerReplaced

URLfileLoader:handlerReplaced(string path)

Method Description

If a new handler is registered for the path associated with an existing URLfileLoader object, the URLdirectory object sends a handlerReplaced message to the previously registered URLfileLoader handler object.

Return Value

This method does not return a value.


Standard.URLfileLoader:getAccessController

URLfileLoader:getAccessController()

Method Description

This method returns the object Id of the URLprotectedFile object that validates access to section of the document tree for which the URLfileLoader object is responsible.


Standard.URLfileLoader:getDirectoryRoots

URLfileLoader:getDirectoryRoots()

Method Description

Returns the set of top-level directories that will be searched for files.


Standard.URLfileLoader:getDefaultFiles

URLfileLoader:getDefaultFiles()

Method Description

Returns the set of file names that will be searched when a URL refers to a directory. The default names are Default.htm and index.html, but alternate names can be specified using the setDefaultFiles method.


Standard.URLfileLoader:setDefaultFiles

URLfileLoader:setDefaultFiles(string file1, string file2, string file3)

Method Description

Replaces the set of file names that will be searched when a URL refers to a directory with the list of names that are passed as arguments. Order is significant: each argument has precedence over subsequent arguments.

Return Value

Always returns an integer value of zero.


Standard.URLfileLoader:loadFile

URLfileLoader:loadFile(array uriInfo, assoc substVars, any requestOp)

Method Description

The loadFile method is the means by which a document is located and cached using an HTTPcachedFile (or allomorphic equivalent) object. The first argument, uriInfo is a parsed URI, which is typically obtained from a URI string using the parseHTTPuriData() function. The second argument, substVars is an associative array of environment variables that can be used by a newly created object. As an example, HTML pages with server-side-include directives can be automatically processed by a HTTP_SSIprocessor object and the substVars argument holds the initial environment.

The third argument, requestOp indicates the HTTP method associated with the retrieval. If not present, it is assumed to be "GET".

Note: the newly created object is not registered with the URLdirectory object; if desired, this must be done later using the registerObject method.

Return Value

If the requested file cannot be loaded, nil is returned; otherwise an array describing the cached result is returned. Subscript 0 holds the object Id of the HTTPcachedObject (or equivalent). Subscript 1 holds a set of names that refer to the cached document; these names normally should be registered with the URLdirectory representing the logical site.