Changing IntraWeb application type

From RAD Studio
Jump to: navigation, search

Go Up to Getting started with IntraWeb Index


If you have created an IntraWeb (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 Project > View 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.
  1. Add the following exports section before the program entry point:

     exports
       GetExtensionVersion,
       HttpExtensionProc,
       TerminateExtension;
    
  2. 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 Project > View 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.

See Also