 | | | S/Web Objects 

Document This object handles information relating to a repository based document. Properties: | Property | Get/Set | Description |
|---|
| CACHE | Get/Set | Defines whether all documents are cached. | | COMPRESSION | Get/Set | Defines whether all documents are compressed. | | XVERSION | Get | Contains the current S/Web version |
Methods: call www_Exec_Method( "DOCUMENT", method, param1, param2, param3, param4, param5 ) | Method | Description |
|---|
| CREATE | Opens the handle of the WWW_DOCUMENT file and places it in the wwwDocumentHandle@ S/Web common variable.
Note: This method should not be called by the end user! | | GET | Retrieves properties for the current document object | | READ | Reads a document stored in the repository. | | PURGE | Purges the current document cache. | | SET | Sets properties of the current client object. |
[top] 
This method should not be called by the end user! | Argument | Description |
|---|
| param1 | Not used. | | param2 | Not used. | | param3 | Not used. | | param4 | Not used. | | param5 | Not used. |
[top] 
This method retrieves properties for the DOCUMENT object. | Argument | Description |
|---|
| param1 | An @RM list of properties to retrieve | | param2 | An @RM list of retrieved property values. | | param3 | Not used. | | param4 | Not used. | | param5 | Not used. |
Example: declare function www_Exec_Method, www_Get_Status, www_Set_Status $insert www_Status_Equates $insert logical Properties = "COMPRESSION" Properties := @RM : "CACHE" if www_Exec_Method( "GET", Properties, RetVals, "", "", "", "", errorText ) then CompressionVal = Field( RetVals, @RM, 1 ) CacheVal = Field( RetVals, @RM, 2 ) end else abort = TRUE$ end [top] 
This function reads the document from file. As a document may be > 64K the example below shows a loop to retrieve a large document. In real life if you know the document is < 64K you may just issue a single document READ. | Argument | Description |
|---|
| param1 | The document type (HTML, JS, CSS, etc) | | param2 | Document object name. | | param3 | Returned document. | | param4 | Defined properties in repository for this document | | param5 | Current buffer number. | | param6 | Total number of buffers |
Example: declare function www_Exec_Method, www_Get_Status, www_Set_Status $insert www_Status_Equates $insert logical ...... loop www_Exec_Method( "DOCUMENT", "READ", classID, docID, docBuffer, docProperties, docBufferNo, docBufferCount ) if www_Get_Status( errorText ) then abort = TRUE$ end else call www_Exec_Method( "RESPONSE", "SETCONTENT", docBuffer, "+" ) docBufferNo += 1 if ( docBufferNo > docBufferCount ) then eofDocument = TRUE$ end end until ( eofDocument or abort ) repeat if abort then goSub setStdError end else * // Now set the content type ... thisData = docProperties<WWW_REPOSITORY$HTTP_CONTENT_TYPE$> if len( thisData ) then call www_Set_Property( "RESPONSE", "CONTENTTYPE", thisData ) if www_Get_Status( errorText ) then abort = TRUE$ goSub setStdError end end end [top] 
This function purges the client cache table | Argument | Description |
|---|
| param1 | If Logical True then clear disk cache as well | | param2 | Not used. | | param3 | Not used. | | param4 | Not used. | | param5 | Not used. | | param6 | Not used. |
Example: declare function www_Exec_Method, www_Get_Status, www_Set_Status $insert www_Status_Equates $insert logical ...... PurgeDisk = True$ www_Exec_Method( "DOCUMENT", "PURGE", PurgeDisk, "", "", "", "", ErrorText) [top] 
This function sets properties in the document object. | Argument | Description |
|---|
| param1 | An @RM list of properties to retrieve | | param2 | An @RM list of retrieved property values. | | param3 | An @RM list of original property values. | | param4 | Not used. | | param5 | Not used. |
Example: declare function www_Exec_Method, www_Get_Status, www_Set_Status $insert www_Status_Equates $insert logical * Turn compression on, but stop caching documents. Properties = "COMPRESSION" Properties := @RM : "CACHE" Values = True$ Values := False$ if www_Exec_Method( "SET", Properties, RetVals, OrigRetVals, "", "", "", errorText ) then OrigCompressionVal = Field( OrigRetVals, @RM, 1 ) OrigCacheVal = Field( OrigRetVals, @RM, 2 ) end else abort = TRUE$ end [top] 
|  |  |  |