Michael and Alexander:
We, sometimes, modify the actual content of the response, as well as
modifying the headers as well. So we would need access to both headers and
response body. We haven't tried playing with the request, yet, but I can see
the potential uses.
I'm trying to figure out if it is useful to read/write the request body in addition to the request headers. Since I am parsing out the request body anyway I _could_ pass the parsed data to the pre-execute hook instead of the whole request as a BLOB. It seems to me that would be much more useful.
This would let you inspect and rewrite the actual query string params/form variables before the request is executed and the built-in collections (form variables, query params, etc) are created.
We currently post-process the whole response blob prior to sending it,. We
use this to "skin" our application. The base 'skin' has a specific directory
and when we want to switch skins, we set a 4d process variable from within
the active4d.on execute end method, that then will replace the directory
string in the result blob. This replacing is done using Qfree.
Obviously if I could do this from a script.....
Ouch...that means On Execute End is passing the entire response BLOB to a 4D method (one copy) which then calls QFree, and passes back the modified BLOB (another copy)?
Do I understand correctly that you are changing a specific directory in all links within the page, or something like that?
Back to the execute hook, would you prefer the hook to be in Active4D or in 4D? The nice thing about having them in Active4D is that you have native access to the built-in collections. Actually, I really like this approach, because it is much cleaner. I simply add two event handlers:
On PreExecute($ioURL; $ioRequestInfo; $ioQueryParams; $ioFormVariables) -> outStatus
$ioURL Text The requested URL
(only the directory portion, no host or protocol)
$ioRequestHeaders Longint Handle to the built-in 'request info' collection
$ioQueryParams Longint Handle to the built-in 'query params' collection
$ioFormVariables Longint Handle to the built-in 'form variables' collection
RESULT Longint 200 to allow execution, anything else to abort execution
This gives you a chance to munge them (at your own risk) before actual execution. If outStatus is not 200, the request will not be executed and a standard static error response will be generated.
On PostExecute($ioResponseHeaders; $ioResponseCookies; &$ioResponse)
The first two parameters are handles to the built-in Active4D collections, the third is the actual response BLOB.
Comments and suggestions are most welcome.
Regards,
Aparajita Victory-Heart Productions [EMAIL PROTECTED] www.aparajitaworld.com
