isFlushed() to detect if CFFLUSH has been called

Description

<cfflush> <cfheader statuscode="500" value="cfflush already called">

the current error message has a typo and for clarity should mention cfflush
can't assign value to header, header is alredy committed

after <CFFLUSH> is called <CFHTMLHEAD> throws Page is already flushed

the following code can be used to check for cfflush, but it would be nice to
have a BIF something like isPageBuffered()

HttpServletResponse rsp = pageContext. getHttpServletResponse(); if(rsp.isCommitted())

perhaps <cfheader> also needs an option like for <cflock throw=false> which could be a short cut
for writing the following

<cfif not isPageBuffered()> <cfheader statuscode="500" value="cfflush already called"> </cfif>

also, should flush(); be available? No matching function [FLUSH] found cfflush(); works

Environment

None

Activity

Zac Spitzer 
4 August 2021 at 19:15

isFlushed() feels more cfml-y,

I think we should just add this function to core

Michael Offner 
12 October 2017 at 12:45

simply copy this code to library/function/isComitted.cfm

function isCommitted() { return getPageContext() .getHttpServletResponse() .isCommitted(); }

Pothys - MitrahSoft 
11 October 2017 at 15:13

I've tested with above code & Confirmed the issue happened. If cfflush calls before <cfheader>,<cfhtmlhead> means it throw error. In ACF also throw same error.

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 11 October 2017 at 01:08
Updated 22 April 2025 at 10:23
Resolved 10 March 2024 at 00:58