ColdFusion – How do I retrieve the current value of EnablecfoutPutonly?

We are using Coldfusion 9.

Is there an easy way to know if enablecfoutputonly has been set to true during a particular request?

I cannot use CF9 for testing now, but in CF10, you can check the output object from getPageContext ()Access it:


out = getPageContext().getOut();
// Is the cfsetting enablecfoutputonly value currently true?
isSettingEnabled = out.getDisableCount()> 0;
WriteOutput("isSettingEnabled="& isSettingEnabled &"
");
// Is output currently allowed?
isOuputtingEnabled = out.getDisableCount() == 0 || out.getOutputCount()> 0;
WriteOutput("isOuputtingEnabled="& isOuputtingEnabled &"
");

.. Or use reflection:


out = getPageContext().getOut();
internalMethod = out.getClass().getDeclaredMethod("isOutputEnabled", []);
internalMethod.setAccessible( true );
isOuputtingEnabled = internalMethod.invoke( out, [] );
// is output currently allowed?
WriteOutput("isOuputtingEnabled="& isOuputtingEnabled);

We are using Coldfusion 9.

Is there an easy way to know if enablecfoutputonly has been enabled during a specific request? Set to true?

I cannot use CF9 for testing now, but in CF10, it can be accessed from getPageContext() by checking the output object:


out = getPageContext().getOut();
// Is the cfsetting enablecfoutputonly value currently true?
isSettingEnabled = out.getDisableCount ()> 0;
WriteOutput("isSettingEnabled="& isSettingEnabled &"
");
// Is output currently allowed?
isOuputtingEnabled = out.getDisableCount() == 0 || out.getOutputCount()> 0;
WriteOutput("isOuputtingEnabled="& isOuputtingEnabled &"
");

.. or use reflection :


out = getPageContext().getOut();
internalMethod = out.getClass().getDeclaredMethod("isOutputEnabled", []);
internalMethod.setAccessible( true );
isOuputtingEnabled = internalMethod.invoke( out, [] );
// is output currently allowed?
WriteOutput("isOuputtingEnabled ="& isOuputtingEnabled);

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 235 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.