Difference between revisions of "THttpServer.OnGetDocument"

From Overbyte
Jump to navigation Jump to search
 
 
Line 26: Line 26:
 
     if Uppercase(lClient.Path) = '/SHOWPATH' then
 
     if Uppercase(lClient.Path) = '/SHOWPATH' then
 
     begin
 
     begin
       lClient.AnswerString(Flags, '', '', '', 'This is the path: ' + lClient.Path);
+
       lClient.AnswerString(Flags, ''''''', ''''''', ''''''', 'This is the path: ' + lClient.Path);
 
     end
 
     end
 
     else
 
     else
 
     if Uppercase(lClient.Path) = '/HELP' then
 
     if Uppercase(lClient.Path) = '/HELP' then
 
     begin
 
     begin
       lClient.AnswerString(Flags, '', '', '', 'Sorry! We can''t help you.');
+
       lClient.AnswerString(Flags, ''''''', ''''''', ''''''', 'Sorry! We can'''''''t help you.');
 
     end
 
     end
 
     else
 
     else
       lClient.AnswerString(Flags, '', '', '', 'Sorry, this request doesn''t do it for me. ' + lClient.Path);
+
       lClient.AnswerString(Flags, ''''''', ''''''', ''''''', 'Sorry, this request doesn'''''''t do it for me. ' + lClient.Path);
 
    
 
    
 
   end;
 
   end;
  
 
== Best practices ==
 
== Best practices ==

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

Best practices