THttpServer.OnGetDocument

From Overbyte
Jump to navigation Jump to search

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 can''t help you.');
   end
   else
     lClient.AnswerString(Flags, '', '', '', 'Sorry, this request doesn''t do it for me. ' + lClient.Path);
 
 end;

Best practices