1. Home
  2. Computing & Technology
  3. Delphi Programming
RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To
 
ISAPI tutorial for Delphi developers
Page 3: Getting started
 More of this Feature
• Pg 1: Intro to web-broker
• Pg 2: Using this tutorial
• Pg 4: Web Actions
• Pg 5: The first ISAPI app
• Pg 6: TWebRequestObject
• Pg 7: Request-responding
• Pg 8: TPageProducers
• Pg 9: Cookies made easy
• Pg 10: Stateless HTTP
• Pg 11: DB enabled apps
• Pg 12: FAQ
• Pg 13: DB apps - Part 1
• Pg 14: DB apps - Part 2
• Pg 15: DB apps - Part 3
 Join the Discussion
"Post your questions, concerns, views and comments to this article..."
Discuss!
 Related Resources
• Internet programming
• CGI and ISAPI with Delphi

Before we actually start programming, let's take a brief look at how to start an ISAPI application and what Delphi gives us.

To start a new ISAPI project, in the File menu, click on New and then choose Web Server Application.

Delphi will then present you with a choice of three types of web server applications. In our case we are going to choose the default (ISAPI/NSAPI).

New Web Server Application

Once you click on Ok, a new project will be opened. By default a new form is created. This form is the main starting point of your ISAPI application. It is a TWebModule. As mentioned in the previous chapter, the TWebModule consists of a TDataModule + TWebDispatcher. The first thing you will see is that, as with datamodules, the webmodule has very few properties and events. In particular, it consists of the following:

TWebModule.Actions

·Actions These are the WebActions. We will take a look at them later.
·Name, OldCreateOrder,Tag Nothing new. Same as other component properties.

TWebModule.AfterDispatch

·AfterDispatch This event is fired after a call has been made to one of the Webactions
·BeforeDispatch This event is fired before a call has been made to one of the Webactions
·OnCreate/OnDestroy As with other forms, you have the OnCreate/OnDestroy events

   WebActions: The heart of the application
It's true. Without the Webactions, you couldn't really do much of an ISAPI application. Let's see how these webactions work.

Every request made by the client (in our case normally a web browser) is a standard HTTP request. To make things easier, Delphi brings you the power of the TWebDispatcher. What this does is translate the HTTP request to a web action. Imagine the web action as an entry point to your DLL, like any other DLL you create and export the functions, web actions have a similar way of working.

procedure TWebModule1.WebModule1WebActionItemAction
(Sender:TObject; Request: TWebRequest;
Response: TWebResponse; var Handled: Boolean);
begin

end;

·Default This sets the web action to the default one. When a HTTP request is made, the TWebDispatcher tries to match the MethodType and PathInfo to an action. If one is not found, then the default action will be used.
·Enabled Enable or disable the web action. Very rarely would you want to create a web action and then disable it. However, this is exactly what this property does.
·MethodType Type of HTTP request. We will be focusing more on the mtPut and mtGet. However, you could leave this type as mtAny.
·Name The name of the web action
·PathInfo This is one of the most important properties. It's how the web action is called from the client. For example: http://localhost/scripts/project1.dll/LetsGoForIt. LetsGoForIt constitutes the PathInfo.

Next page > Web Actions > Page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

All graphics (if any) in this feature created by Zarko Gajic.

 More Delphi
· Learn another routine every day - RTL Quick Reference.
· Download free source code applications and components.
· Talk about Delphi Programming, real time.
· Link to the Delphi Programming site from your Web pages.
· Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC.
· NEXT ARTICLE: ADO Cursors - DB/10.
Chapter ten of the free Delphi Database Course for beginners. How ADO uses cursors as a storage and access mechanism, and what you should do to choose the best cursor for your Delphi ADO application.
 Stay informed with all new and interesting things about Delphi (for free).
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Reader's Choice Award Winners

What are the best instant messengers, apps, editors and more? You told us, for our 2010 technology awards program. More >

iPad Central

Is Apple's new tablet computer impractical, a must-have -- or both? We'll help you figure it out. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2010 About.com, a part of The New York Times Company.

All rights reserved.