<!--- Function for undoing anything that CfHtmlHead intends to do --->
<cffunction name="resetCFHtmlHead" output="false" returntype="void">
<cfscript>
var local = StructNew();
local.out = getPageContext().getOut();
while (getMetaData(local.out).getName() Is 'coldfusion.runtime.NeoBodyContent') {
local.out = local.out.getEnclosingWriter();
}
local.method = local.out.getClass().getDeclaredMethod('initHeaderBuffer', ArrayNew(1));
local.method.setAccessible(true);
local.method.invoke(local.out, ArrayNew(1));
</cfscript>
</cffunction>
<!--- Function for retrieving anything that CfHtmlHead intends to do --->
<cffunction name="getCFHtmlHead" output="false" returntype="any">
<cfscript>
var local = StructNew();
local.out = getPageContext().getOut();
while (getMetaData(local.out).getName() Is 'coldfusion.runtime.NeoBodyContent') {
local.out = local.out.getEnclosingWriter();
}
local.field = local.out.getClass().getDeclaredField("headerBuffer");
local.buffer = 0;
local.field.setAccessible(true);
local.buffer = local.field.get(local.out);
/* The get might return null */
if (StructKeyExists(local, 'buffer')) {
return local.buffer.toString();
} else {
return '';
}
</cfscript>
</cffunction>