[fpc-pascal] FPWebModule: BeforeResponse event?

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Mar 26 09:25:02 CEST 2012

On Sat, 24 Mar 2012, leledumbo wrote:

> I want to do something like this: A base module (call it ModLayout) writes a
> header, then a descendant module (say Mod1, Mod2 and so on) writes the inner
> content, ended by ModLayout writes the footer. With this scenario, the
> header and footer don't need to be written for each Mod1, Mod2 and so on,
> just once in ModLayout. However, there seems to be no BeforeResponse event
> that could do the header writing. There's only AfterRequest and in that
> event, there's no TResponse object passed.
> I could put the header writing in ModLayout's OnRequest and explicitly call
> inherited in each Mod1, Mod2 and so on's OnRequest, but it looks dirty and
> error prone (one could forget to do that easily).

I would do this differently.

Implement the OnRequest in ModLayout, where a virtual 'GetContent' is
defined that tries the webactions. The descendants either implement
webactions, or override getcontent.


More information about the fpc-pascal mailing list