RAD Studio
ContentsIndex
PreviousUpNext
Changing VCL for the Web application type

If you have created a VCL for the Web application and wish to change it to ISAPI/NSAPI or Apache plugins, you can do it with a few simple changes to your code. 

It is, however, recommended that you start with a standalone application, to ease debugging, and later convert the application to an extension.

To change your standalone application to ISAPI/NSAPI:

  1. Open the project source file by selecting ProjectView Source.
  2. In the project source file, change the application type from program to library:
  3. In the uses clause, replace the Forms and IWMain units with ISAPIApp and IWInitISAPI. If you want to use ISAPIThreadPool, include the ISAPIThreadPool unit in the uses clause.
  4. Add the following exports section before the program entry point:

exports
  GetExtensionVersion,
  HttpExtensionProc,
  TerminateExtension;

  1. Replace the contents of begin ... end block with:

begin
  IWRun;
end.

When you are done the project source file should look like this:

library Project1;
        
uses
  ISAPIApp,
  IWInitISAPI,
  ISAPIThreadPool,
  Unit1 in 'Unit1.pas' {IWForm1: TIWAppForm},
  ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
  UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};
        
{$R *.RES}
        
exports
  GetExtensionVersion,
  HttpExtensionProc,
  TerminateExtension;
        
begin
  IWRun;
end.
To change your standalone application to a service application:

  1. Open the project source file by selecting ProjectView Source.
  2. In the uses clause, replace the Forms and IWMain units with IWInitService.
  3. Replace the contents of the begin ... end block with:

begin
  IWRun;
end.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!