So I’ve often wondered how builtin tags like cfsavecontent, cfdocument, cfquery, etc work; being able to grab the text generated inside the tags.
Well the other day I was working on letting users download files out of a zipped archive, by streaming the decompressed data straight to the browser, which I did using getPageContext to get the output stream.
Afterwards it occurred to me that this must be how tags like cfsavecontent working, just inverted; that they’re changing the output stream so the generated text goes to the stream and into a variable, rather than getting written to the stream that goes to the user’s browser.
So my question is, is there a way for us plebeian programmers to do this as well? Obviously we would have to instantiate a java outputstream (no issues there). But I can’t find where I would set my stream as the one where lucee writes the output too.
EDIT: So of course none of the guides I’ve read up till now on custom tags have mentioned it, but right after I make this post I find one which mentions thisTag.generatedContent Figures.
I would however still like to pose the same question to the lucee devs, because it would just be really, really useful: is there a way to set the outputstream that generated content is written to? Either for a custom tag, or just the a regular cfm script.