• No results found

Summary of Application object methods

In document HAHTsite IDE Programming Guide (Page 123-128)

The following table lists the methods available with the Application object (with the exception of methods related to access control and CORBA, which are covered in later chapters). For a fuller description of each method, consult the on-line help for the Server Object Model.

Field Description

"AppendString" String (if any) this subsite’s Web server appends to the URL of a dynamic page.

Example: ?

"DynamicURL" URL for the directory defined by the Web server’s CGI alias.

Example: http://www.haht.com/cgi-bin "HSrunAppendString" String (if any) this subsite’s Web server appends to

the HSrun command.

"HSrunExtension" String (if any) this subsite’s Web server expects the HSrun executable to have.

Example: .hse

"HSrunParamDelimiter" Character used as a delimiter between parameters passed on the URL.

Example: &

"StaticROOT" Path to subsite’s document root directory. Example: \\moe\D\Netscape\SuiteSpot\docs "StaticURL" URL to default subsite’s document root directory.

Same as getStaticURL.

Example: http://www.haht.com "ProjectSubDir"1

1. For compatibility with past releases, “SubDirURL” can be substituted for “ProjectSubDir.”

Project subdirectory under application root directory.

Example: %project%

"SubSiteName" Subsite name associated with index (zero-based). Same as getSubSite.

Note - When a file system pathname is returned (rather than a WWW URL), its format is operating system-dependent. For example, for an NT system, getDirname would return \subdirectory\, while for a UNIX system, it would return /subdirectory/.

Method Description

addApplicationListener (Java only). Adds an event listener to the Application Event Listener.

get Retrieves the value of a name/value pair stored in the Application object (see put). The value is returned as an Object and, in Java, must be cast to the appropriate class. getAppData Depending on the fieldName argument,

returns information about the application for the given subsite.

getDirName Directory part of HAHTsite executable file pathname, relative to the application root directory.

NT example: \JSimple\ UNIX example: /Jsimple/

This value is useful for accessing user data files that are organized in the same manner as the application; the data files will be in a parallel subdirectory with the same name under the Userroot directory. Note, however, that this directory is relative to the configured

Application Root directory. Thus, what is returned as ‘/’ here may indeed be ‘usr/local/WebApp/AppRoot’.

getName Application name without extension or path. Example: Test

getPathName Full pathname of HAHTsite executable file. NT example: \JSimple\Test.htx

getStaticRoot Path to Web server’s document root directory for the default subsite. The document root directory is where the Web server stores its static pages.

NT example: \\moe\d\hahtsite\doctree UNIX example:

/usr/local/hahtsite/doctree getStaticURL URL to default subsite’s document root

directory.

Example: http://www.haht.com

getString Retrieves the value of a name/value pair that is a string stored in the Application object. See putString.

getSubSite Subsite name associated with index (zero- based).

Example: default

getSubSiteCount Number of subsites defined for the application, including the default subsite.

getUserRoot Path to application’s initial working directory (operating system dependent). If your code reads or writes a file without specifying an absolute path, the application looks for the file in the application’s userroot directory. Files that a user attaches to a form (using File Upload) are also placed in userroot.

When you install the Application Server or modify its properties, you set the userroot Transfer URL (shown in a site definition below), which defaults to

HAHTsiteInstallDir\userroot. If you publish your project to a subdirectory, the subdirectory’s name is appended to the userroot path (for example,

\\moe\WebDocs\userroot\MyProject).

isBasicApp Returns true if this is a HAHTtalk Basic application.

isJavaApp Returns true if this is a Java application. isRecordingPageVisits Returns true if sessions of this application are

recording a history of pages visited.

isUsingCookies Returns true if the application was published

Method Description

Dynamic - server group:

Server Group Host: moe.haht.com Server Group: webapps

File: d:\hahtsite\sites\cache\moe.haht.com \webapps.hsg

Subdirectory: %project% State IDs in: Cookies Location: approot Transfer URL: \\moe\WebDocs\approot Location: userroot Transfer URL: \\moe\WebDocs\userroot Location: javaroot Transfer URL: \\moe\WebDocs\javaroot

lock Acquires a lock for the Application object’s variables.

onSessionStart, onSessionEnd

Event handler called when a new session is created, or right before a session is destroyed. In a Java project, can be customized in HahtApplication.java. (Not accessible in HAHTtalk Basic projects.)

onStart, onEnd Event handler called when the application has just been created or just before it is

terminated. In a Java project, can be

customized in HahtApplication.java. (Not accessible in HAHTtalk Basic projects.)

put Associates an object with a name and stores the name/value pair in the Application object. See get.

putString Associates a string value with a name and stores the name/value pair in the

Application object. See getString. remove Removes the association of the named

variable with a value. Applies to name/value pairs created with put or putString.

removeApplicationListener (Java projects only). Removes an event listener from the list of Application listeners. startRecordingPageVisits,

stopRecordingPageVisits

Tells the Application Server to begin/stop recording a history of pages visited. To retrieve this history, use the Session object’s getPagesVisited method. unlock Releases the lock for the Application

object’s variables.

writeLog Writes a string to the Application Server’s log file.

In document HAHTsite IDE Programming Guide (Page 123-128)