Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-11

Using areq.getnextpathinfo in a CGI module

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luciano de Souza

Hello listers,

I am trying to understand how to create some code using Custcgi. However, the following peace is not clear for me concerning to "getnextpathinfo". Let's see:

program cgiproject1;
{$mode objfpc}{$H+}
uses
   HTTPDefs, custweb, custcgi, main;
type
   { TMyCGIHandler }
   TMyCGIHandler = class(TCGIHandler)
   public
     procedure HandleRequest(AReq: TRequest; ARes: TResponse); override;
   end;
   TMyCGIApp = class(TCustomCGIApplication)
   protected
     function InitializeWebHandler: TWebHandler; override;
   end;
procedure TMyCGIHandler.HandleRequest(AReq: TRequest; ARes: TResponse);
begin
   if AReq.GetNextPathInfo = 'test' then
     CGITest(AReq, ARes)
   else
     CGIAbreHtml(AReq, ARes);
end;
function TMyCGIApp.InitializeWebHandler: TWebHandler;
begin
   Result := TMyCGIHandler.Create(self);
end;
begin
   With TMyCGIApp.Create(Nil) do
     try
       Initialize;
       Run;
     finally
       Free;
     end;
end.

The code seems to be logical. I created a tCGIApplication derived from tCustomApplication, in other words, the object responsible for the program initialization.

By means of "initializeWebHandler", a tCGIHandler object is created. Of course, this is the responsible for requests and responses handling.

Everything is good until:

if AReq.GetNextPathInfo = 'test' then
CGITest(AReq, ARes)
else

     CGIAbreHtml(AReq, ARes);

en

What does it mean "AReq.GetNextPathInfo = 'test'"?

Best regards,

Luciano

silvioprog
to Luciano de Souza

Please send your "main" unit (or your small project compacted in zip).

2011/11/1 Luciano de Souza :
[..]

Silvio Clécio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> ===============================================    * Conheça nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================