fcl-web - html web modules

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fcl-web - html web modules

African Wild Dog
Hello,

How to use action and sessions with HTML Web Modules?

It seems fcl-web is an incomplete work. How can i help? Is there any list of incomplete implementations/to-do works?

Regards

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fcl-web - html web modules

Michael Van Canneyt


On Fri, 23 Feb 2018, African Wild Dog wrote:

> Hello,
>
> How to use action and sessions with HTML Web Modules?

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.

>
> It seems fcl-web is an incomplete work. How can i help? Is there any list
> of incomplete implementations/to-do works?

Basic FCL-Web is very complete and in production use in many applications.

The only "incomplete" domain is pageproducer and friends (all things
'Producer'). This was an early attempt at mimicking early Delphi web
classes, an approach which I have since abandoned.

But the JSON-RPC or Ext.Direct JSON RPC mechanism and data exhange mechanism
and related things work very well in production since 7+ years.

If you have specific questions not answered in the above info, ask and I
will do my best to answer.


Michael.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fcl-web - html web modules

African Wild Dog

2018-02-23 19:36 GMT-03:00 Michael Van Canneyt <[hidden email]>:

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;


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal