[fpc-pascal] fcl-web - html web modules

African Wild Dog paintedlycaon at gmail.com
Sat Feb 24 00:03:28 CET 2018


2018-02-23 19:36 GMT-03:00 Michael Van Canneyt <michael at freepascal.org>:

>
> What is not clear ? There are several samples available that show their
> use ?
>
> Also the WIKI has some pages about it
> http://wiki.freepascal.org/fcl-web
>
> There are some articles
> https://idefix.freepascal.org/~michael/articles/
>
> see the web1 and web2 and webserver articles.
>
> I think Web2 explains what you need.


According to your article, "Session support is introduced by
TSessionHTTPModule". However, TFPHTMLModule descends
from TCustomHTMLModule. TCustomHTMLModule descends from TCustomHTTPModule.
Then, there is no session support for  TFPHTMLModule.

Another point: using  TFPHTMLModule, request are handled by the module
itself through the OnGetContent event, not by the actions. In the other
words,  the request never is transferred to the actions.


*procedure TCustomHTMLModule.HandleRequest(ARequest: TRequest; AResponse:
TResponse);*
*Var*
*  FWriter : THTMLWriter;*
*  B : Boolean;*
*  M : TMemoryStream;*

*begin*
*  FDocument := CreateDocument;*
*  Try*
*    FWriter:=CreateWriter(FDocument);*
*    Try*
*      B:=False;*
*      If Assigned(OnGetContent) then*
*        OnGetContent(Self,ARequest,FWriter,B);*
*      If Not B then*
*        Raise EHTMLError.Create(SErrRequestNotHandled);*
*      If (AResponse.ContentStream=Nil) then*
*        begin*
*        M:=TMemoryStream.Create;*
*        AResponse.ContentStream:=M;*
*        end;*
*      FDocument.SaveToStream(AResponse.ContentStream);*
*    Finally*
*      FreeAndNil(FWriter);*
*    end;*
*  Finally*
*    FreeAndNil(FDocument);*
*  end;*
*end;*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180223/3130b765/attachment-0001.html>


More information about the fpc-pascal mailing list