The WebSTAR Application Program Interface ( API ) is a modular, high-performance technique for developers to extend the functionality of WebSTAR. The WebSTAR API uses CFM on PowerPC systems to implement these Plug-Ins.
WebSTAR API Plug-Ins exist as part of the web server's running code, can be called from threads within WebSTAR, and have access to data and services provided to the Plug-In by the web server. Plug-In developers have to take care to cooperate with the web server and other Plug-Ins. Provisions exist for giving Plug-Ins idle CPU time on a regular basis, so you aren't limited to performing all of your processing in the context of a single subroutine call. In addition, Plug-Ins can listen on multiple TCP ports, perform routing of browser requests, return to the server the HTTP response code they sent to the client, and display their own windows.
Complete documentation of the WebSTAR API is included in the WebSTAR API SDK, which is a custom install option in the WebSTAR Server Suite Installer . The SDK can also be found at:
ftp://ftp.starnine.com/pub/webstar_dev/wsapi_sdk.sea.hqx
All Filter Plug-Ins get called immediately after the server has read the incoming HTTP request and before any processing has begun. They will receive all the request information, and can change it as appropriate. For example, the WebSTAR JRun Servlet Runner checks for the text /servlet/ in a URL and adds the suffix .servlet . This ensures that the WebSTAR Suffix Mapping process will correctly direct requests for Java servlets. Then the filter passes the request back to the server, which may pass it to another filter. For WebSTAR, all Filter Plug-Ins are invoked in reverse alphabetic order (i.e., last to load is first to run). The details are contained in the WebSTAR API documentation.
Filters can only change request text, they can't return results.
There are good reasons to write a filter rather than a Pre-processor: Your filter can work with other filters, while each server can only have one Pre- processor, making filters much more compatible. And filters can automatically install the suffix data in the Suffix Mapping Table, while Pre-processors must be designated by the user.
This table contains a complete listing of WebSTAR API parameters, keywords and a short description describing the value returned.
While these WebSTAR API parameters are primarily for use by WebSTAR API Plug-In developers, they can also be used in connection with Plug-Ins like WebSTAR SSI which allow WebSTAR API parameter values to be returned from the echo command. For instance:
<!--#echo var="piTotalConnections"-->
In addition, the values of these parameters are accessible by the WSAPI_GetIindexedParameter Apple Event function.
If the path to a Plug-In processed URL request is incorrect, the WebSTAR Web server will now serve the user-defined Error file.
Under previous versions of WebSTAR when a bad URL request (i.e. http://ww.domain.com/bogus.ssi ) was sent to a Plug-In, that Plug-In was responsible for returning an error message to the user saying that the file did not exist. Note that in this situation the defined Error file was not being processed. Now if a Plug-In returns a WSAPI_E_MessageNotHandled from a non-existent file request, the WebSTAR Web server will now handle normal processing of the Error file (instead of just returning a 404 status code).
For more information about how to develop Plug-Ins that work with the WebSTAR server, see:
http://dev.starnine.com
ClearWay's WebSTAR API Plug-In Cookbook:
http://dev.clearway.com/