[fpc-pascal] TJSONRPCModule: access the request from an handler.
Michael Van Canneyt
michael at freepascal.org
Fri Sep 9 16:05:22 CEST 2022
On Fri, 9 Sep 2022, Luca Olivetti via fpc-pascal wrote:
> El 9/9/22 a les 15:50, Michael Van Canneyt ha escrit:
>
>> The solution is much more simple.
>>
>> Override HandleRequest() in the module.
>> Save the request in a variable and call inherited.
>
> Much simpler indeed! Thank you.
> In my case I just save the remote address, but in your example below I
> suppose you redefined FRequest (and FResponse) to hide the private one in the
> ancestor, but what I don't understand is the C:=C+C and the need to set
> FRequest and FResponse to nil.
You can remove the C variable stuff, it was for debugging purposes. I simply
didn't remove it during the copy & paste.
I set the variables to Nil after calling inherited (where the request is
actualluy handled) so they are not inadvertently used in the
OnDestroy of the datamodule.
Michael.
More information about the fpc-pascal
mailing list