Difference between revisions of "THttpServer.OnGetDocument"

From Overbyte
Jump to navigation Jump to search
(No difference)

Revision as of 13:38, 30 September 2007

Main page -> ICS components reference -> THttpServer -> OnGetDocument

Definition

procedure THttpServer.OnGetDocument(Sender, Client: TObject; var Flags: THttGetFlag) of object;


  • Sender :
  • Client : the client which fired the event
  • Flags :

Description

This event will fire upon a request to get a document from the webserver.

Examples

Return various testdata on requests

 procedure TWebServerDM.WebServerGetDocument(Sender, Client: TObject;
   var Flags: THttpGetFlag);
 var
   lClient  : THttpConnection;
 begin
     
   lClient := THttpConnection(Client);
   
   if Uppercase(lClient.Path) = '/SHOWPATH' then
   begin
     lClient.AnswerString(Flags, , , , 'This is the path: ' + lClient.Path);
   end
   else
   if Uppercase(lClient.Path) = '/HELP' then
   begin
     lClient.AnswerString(Flags, , , , 'Sorry! We cant help you.');
   end
   else
     lClient.AnswerString(Flags, , , , 'Sorry, this request doesnt do it for me. ' + lClient.Path);
 
 end;

Best practices