Small company logo:
   History
 
Advertising banner:
 
 A159
Home • Help • A0 • Internet Services • A159
 
Using Internet Services APIs (ISAPIs)




Internet Services API (ISAPI - Windows only)
ISAPI lets you develop web-based applications that run faster than conventional CGI programs because they're more tightly integrated with Internet Services. This allows you to use dynamic web applications (also called scripts) to enhance your FirstClass system. You can write an ISAPI script in any language that will create an executable object on your system. For example, C++, Visual Basic, or Perlscript on Windows.
The primary difference between an ISAPI program and a CGI program is that an ISAPI program remains loaded in the server after it has first been loaded in memory. Conversely, a CGI program is loaded into memory after each application request from the user's web browser, then unloaded from memory once the programs have been executed. This means that ISAPI programs tend to run faster than CGI programs.
WithoutISAPI2.png
WithISAPI.png



Using the AddHandler document to configure ISAPI applications
The AddHandler document determines how to run additional programs in response to special HTTP requests handled by Internet Services. There are two ways of defining how to associate web requests with programs: file associations and Content-Type associations. The file associations specified in this document override any file associations that are set up by the operating system. Content-Type associations work by comparing the Content-Type header in each HTTP request against the values specified in this document, instead of the file extension at the end of the request URL.
The AddHandler document is both helpful and necessary because
•       some interpreters do not automatically set up file associations when installed
•       some operating systems do not have an easy way of maintaining file associations
•       some types of HTTP requests can handled without having to create dummy documents in the cgi-bin folder.

The AddHandler document is located in the Internet Services folder on the administrator's Desktop and is automatically created when you do a new install or when you upgrade. This document supports two different commands: AddHandler and AddURLHandler. Each command spans multiple lines, with comments and blank lines allowed for documentation and readability. Lines within each command do not have to be specified in a particular order.
This is the syntax for the AddHandler command:
<AddHandler .ext>
Site: sitename or *
If-Content-Type: MIME type/subtype
ISAPI.Ext: full path of ISAPI dll to load
exec: full path of CGI to run
</AddHandler>
where
ext is the filename extension to handle.
        For example
• .php
        • .pl
• .sitename or * works the same as in the Multiple Sites & Languages form and other configuration documents
MIME type/subtype is the Content Type to match in HTTP requests
        For example
                application/vnd.syncml+wbxml
        The If-Content-Type is optional and, if specified, overrides the value of .ext. In this case, we recommend that you set .ext to .dummy as a documentation aid.
ISAPI.Ext is used to run ISAPI extensions (as opposed to ISAPI filters, which are not supported.)
exec is used to run executables and is an alternative to having to create file associations in Windows. It is also used for running different types of scripts (for example, PHP) where that isn't possible.
06092010_122716_1.pngNote
Either ISAPI.Ext or exec may be used in a single AddHandler command, but not both.
This is the syntax for the AddURLHandler command:
<AddURLHandler /URL/goes/here>
Site: sitename or *
Templates: template folder name
</AddURLHandler>
When Internet Services receives a request for /URL/goes/here that matches the site, it uses the template folder specified to process the request.
The AddURLHandler command is intended to allow Internet Services to easily provide different views of parts of a web site. For example, online newspapers and other web sites devoted to dynamic information may use Rich Site Summary (RSS) instead of HTML to deliver the content. An RSS reader can be directed to a different set of templates instead of the HTML set.
Using the Rewrite command
You can use the Rewrite command to
•       support complex CGI applications (for example, Perl/PHP scripts that provide web log Blog functionality) without you having to extensively edit CGI files to change URLs.
• invoke different template sets to provide additional views on conferences and folders.
This is the syntax for the Rewrite command:
<AddURLHandler [~] /URL/>
Site: sitename or *
Templates: Template folder name
Content-Type: <Mime Type of the content the ISAPI extension returns>
Index: alternate name for the Index page
Rewrite: /replacement URL/
</AddURLHandler>
where
• the optional character [~] indicates the /URL/ is a regular expression that includes the use of tags
• Content-type is normally set by the CGI or ISAPI extension and the default is text/html.
However, if the Content-type is not the default or, for the URL handler, if you use alternate templates that do not return text/html, specify the Content-type so the browser will correctly interpret it.
Index allows the use of differently named Index files when /URL/ refers to a container
Rewrite allows you to redirect the browser to a different location, similar to Location: header used by CGIs
Examples of the Rewrite command
If you want to provide your users with an RSS view of a News conference on your site you could add this AddURLHandler syntax to the ISAPI document:
<AddURLHandler ~ /News/rss>
Site: *
Templates: .rsstemplates
Content-Type: <the Rich Site Summary (RSS) content type>
Rewrite: /News/
</AddURLHandler>
If you have an URL that is a regular expression that uses tags, you can specify the tagged text in the replacement URL. This is useful if you want to make part of the URL space 'virtual' on your site:
<AddURLHandler ~ /Mobile/(.*)>
Site: *
Templates: mobile.templates
Rewrite: /\1
</AddURLHandler>
For more information