createVirtualDirectoryFile

createVirtualDirectoryFile(fileName:     String;
                           fileContents: Binary;
                           retain:       Boolean): Integer;

The createVirtualDirectoryFile method of the WebSession class, which passes image files created by a JADE application to the jadehttp library or the mod_jadehttp module, can be reimplemented in your user session class.

The jadehttp library or mod_jadehttp module creates the specified file in the directory (the virtual directory visible to Web browsers) in which the library is running. (See also the WebSession class isVDFilePresent method.)

The createVirtualDirectoryFile method parameters are listed in the following table.

Parameter Description
fileName Name of the file to be created in the virtual directory
fileContents Binary holding the file contents
retain Creates read-only files when set to true or standard files when set to false

This method returns zero (0) if the method successfully formats a request to the jadehttp library or mod_jadehttp module, or it returns the non-zero Windows error code indicating the failure to create the file.

The image files must be passed before the final reply to the Web request is returned.

This process is transparent if your application is using the standard JADE-generated Internet facility. However, if your application logic does additional file generation of its own, you must call this method.

You can specify whether files created in the virtual directory are deleted automatically and how this happens by setting the PurgeDirectoryRule parameter in the [application-name] section of the jadehttp.ini file or the PurgeDirectoryRule configuration directive in the JADE mod_jadehttp. If this parameter or directive is not set, files of type .jpg, .png, or .gif that are more than 12 hours old are removed. For details, see "Internal Housekeeping of the Virtual Directory", in Chapter 2 of the JADE Installation and Configuration Guide.

If your applications are not using the standard JADE-generated Internet facility, you need to set the JADE initialization file Firewall parameter in the [Jadehttp Files] section to true and call the createVirtualDirectoryFile method only if you require firewall separation. (For details, see "Configuring JadeHttp for Remote Connections", in Chapter 2 of the JADE Installation and Configuration Guide.) If you do not require firewall separation, JADE creates image files directly into the virtual directory and bypasses the jadehttp library or mod_jadehttp module.

The file cleanup process that is started when the JADE initialization file Firewall parameter is set to true deletes only files that are not read-only and which are of type .jpg .png, or .gif. You should therefore make all other files in this directory that you want to retain read-only, by setting the retain parameter to true.