> I run some metric updating code in onRequestEnd. In certain cases, I want to > show a message if the metric update fails. I want to replace what is already > in the output buffer. I am trying this in onRequest end: > > <cfset pageContent = getPageContext().getOut().getString()> > <cfset getPageContext().getOut().clearBuffer()> > <cfset pageContent = "hello!"> > <cfset writeOutput(pageContent)> > <cfset getPageContext().getOut().flush()> > > But the original HTML is still outputted and my message is not. If I dump > the getOut() result it is an empty string. I am not using CFFLUSH anywhere, > so why would the HTML already by written from the buffer in onRequestEnd?
The onRequestEnd event happens, strictly speaking, after your page has been run, so I guess it's possible that the page context used for your page no longer exists. The whole request cycle (onRequestStart, onRequest, onRequestEnd) can be a little tricky for things like this. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or onsite. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348613 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

