Table of Contents

OIL2 Class Standard.HTTPcachedObject

class Standard . HTTPcachedObject {
        string  EtagString;
        oid     accessValidator;
        int32   contentLength;
        string  contentType;
        int32   createTime;
        any     data;
        set     dependentObjs;
        assoc   fileInfo;
        string  headerData;
        int32   localExpireTime;
        assoc   modTime;
        set     names;
        int32   resultCode;
        string  resultResponse;
        oid     sleepingThread;
        set     specialHeaders;
        oid     urlDirectory;
inherits from Object;


The HTTPcachedObject class is the base class for objects that hold cached documents, which have been requested via the URLdirectory. It is never used directly, only as the base class of a derived class that implements relevant functionality.



HTTPcachedObject:deleteIfObsolete(int32 currentTime, int32 checkInterval)

Method Description

The deleteIfObsolete method instructs the cached object to delete itself if it will expire within the interval specified by currentTime plus checkInterval.

Return Value

If fromObject is not nil, a Boolean flag is return indicating whether or not the object is obsolete.


HTTPcachedObject:checkIfStillValid(optional int32 currentTime)

Method Description

The checkIfStillValid method is used to determine if a cached object's contents are still valid. For documents that utilize server-side-includes, this involves additionally verifying that the included contents have not been altered.

Return Value

An integer indicating an estimate of the number of seconds until the cached object's contents will expire.


HTTPcachedObject:setAccessValidator(oid obj)

Method Description

The setAccessValidator method is used to protect access to a cached document. The single argument to this method specifies a URLprotectedFile or equivalent object that maintains the relevant password database that controls access to this object.

Return Value

If fromObject is not nil, then 0 is returned.


HTTPcachedObject:validateAccess(any authData, string HTTPcommand, any opaqueCheckValue)

Method Description

Given HTTP authentication data, the validateAccess method returns information indicating if access is permitted or not. See the URLprotectedFile:validateAccess for details.


HTTPcachedObject:noteReplaced(string name)

Method Description

When a newly cached object registers itself using a name already in use, the pre-existing cached object is sent a noteReplaced message. For a HTTPcachedObject, the indicated path name is removed from the list of aliases for the object. If there are no more aliases defined, then the object is deleted.

Return Value

This method does not return a value.


HTTPcachedObject:createFromFile(oid urlDir, array uriInfo, assoc cgiEnv, assoc fileData, string impliedName, string fullName)

Method Description

The createFromFile method is the most common means by which an HTTPcachedObject subclass retrieves data from the local filesytem. No further processing, such as server-side-includes, is done by this method.

Return Value

If successful, 0 is returned; otherwise, a value of -1 is returned to indicate an error was encountered.


HTTPcachedObject:createAfterSubstitutions(oid urlDir, string pageData, string mimeType, assoc substitutions, string name)

Method Description

The createAfterSubstitutions method is used to initialize a HTTPcachedObject -derived object from a string that holds the contents of a file.


This method name should be changed as it no longer performs SSI-related work.



Method Description

Returns the MIME type of the cached content.


HTTPcachedObject:setContentType(string newContentType)

Method Description

Sets the MIME type of the cached content.

Return Value

This method always returns 0.



Method Description

Returns the cached content.


HTTPcachedObject:setFileData(any d, optional int32 timeout, optional set dependObjs)

Method Description

The contents of an existing HTTPcachedObject can be replaced using setFileData. If the MIME type is different than the current contents of the object, the method setContentType should be called first.

Return Value

This method always returns 0.


HTTPcachedObject:setExpireTime(int32 secondsInFuture)

Method Description

The setExpireTime method overrides default expiration time by setting a new time. If secondsInFuture is equal to -1, the cached object's expiration time is removed and effectively made permanent; otherwise the expiration time is set to the current time plus the indicated number of seconds in the future.

Return Value

The new expiration time is returned.


HTTPcachedObject:getRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

The getRequest follows the prototype for all requests generated by the HTTPfastReceive.

The following header options are supported:

Note: most of the conditional headers are handled by the utility method processConditionHeaders. If a document is administratively determined to be too large to cache (configured by the MaximumCacheableSize parameter in the profile passed to the HTTPdaemon object), it is not read into memory but instead the object Id of an open IOobject is returned in place of the data. The HTTPfastReceive object will create a SendFile object to perform the transfer of the entity body. This permits the retrieval of documents that are too large to fit into memory.


HTTPcachedObject:headRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

See getRequest. No entity body will be returned in a HEAD request; the remaining of the behavior is identical to a GET request.


HTTPcachedObject:postRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

Prototype for HTTP POST requests. Returns a 405 (Method Not Allowed) error by sending a returnError message.


HTTPcachedObject:putRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

Replaces an entity. If the entire data has not already been read from the stream, a SendFile object is created to read the remainder, thus eliminating the requirement to have the entire entity be placed into memory before transfer to the local filesystem. This enables the storage of documents that are too large to fit into memory.


HTTPcachedObject:deleteRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

Unlinks a file from the local filesystem and removes the cache object.


HTTPcachedObject:optionsRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

Handles options requests.


HTTPcachedObject:extensionRequest(array requestData, assoc options, string replyMethod, oid replyDest)

Method Description

Handles non-standard HTTP commands, such as WebDAV's MKCOL.