GETTING STARTED

Electron Server offers direct plug-in support for Delphi and C++ developers from the Borland and Codegear community. The pages in this section will show how to install Electron Server, configure the product and write your own plug-ins for the product to enable the creation of your own custom web application frameworks.

If you have questions regarding this content, please email us at support@electronserver.com.

The DELPHI Advantage

If you are a Borland C++ or Delphi developer then you can leverage Borland's advanced run-time packages to inject your own custom classes directly into Electron Server's RTTI (Run-time Type Information) application space in a fully thread-safe way. This is not your father's DLL plug-in! Electron Server uses Dennis Landi's freeware Plug-in Manager Framework available here.

Framework without a Framework

Electron Server provides a new framework for web development without inventing new framework semantics to do so. Instead, Electron Server leverages the file semantics already in use by the HTTP protocol. We do this by allowing the developer to create a custom plug-in class and register a custom file extension with Electron Server which in essence acts as a virtual MIME type for that class.

Let's explain how a plug-in class works in Electron Server. The following code snippet is a slightly contrived example clearly illustrating the basic mechanics of how Electron Server's ultra-light framework works:


    TTest03=class(TInterfacedPersistent IMetaInfo,IE2PageModule)
    
    ...
    
    procedure BuildMetaInfoList;
    begin
       TTest03MetaInfo.add('ext=.test');
      TTest03MetaInfo.add('contentType=text/html');
      TTest03MetaInfo.add('pageTitle=Test_Module');
    end;
    
    
    function TTest03.
             ExecuteModule(Thread:
                           IE2ServerClientThreadPublic)
                           :Boolean;
    var strHtmlPage:string;
    begin
      //let's pass the thread interface
      //to another function that returns HTML output
      strHtmlPage:=GenerateHTMLPage(thread);      
      //append output to the HTTP Output Stream
      QueueString(strHtmlPage);
      result := true;
    end;



A plug-in class is declared implementing Electron Server's IMetaInfo and IE2PageModule interfaces.

Using methods from the IMetaInfo interface (i.e. BuildMetaInfoList()) we register key information about the plug-in class with the core Electron Server engine.

For instance, in the above code we associated the ".test" file extension with the class "TTest03". Now, whenever Electron Server receives a request for a file with the extension ".test", the class TTest03 will be invoked to complete the request.

And this is where the IE2PageModule interface comes in. Electron Server will invoke IE2PageModule's ExecuteModule method to give full control to the plug-in class to complete the response to the HTTP Request.

Notice that ExecuteModule() has a thread parameter of the type: IE2ServerClientThreadPublic. This interface class contains all the information regarding the incoming HTTP request this function needs to process the HTTP response, as well as methods to output the HTTP Response to be streamed back to the client.

Follow the other links on this site to find out all you need to know to create your own plug-ins for Electron Server!