Interceptor Output Buffer
Last updated
Last updated
Every interception point receives a unique request output buffer that can be used to elegantly produce output. Once the interception point is executed, the interceptor service will check to see if the output buffer has content, if it does it will advice to write the output to the ColdFusion output stream. This way, you can produce output very cleanly from your interception points, without adding any messy-encapsulation breaking output=true
tags to your interceptors. (BAD PRACTICE). This is an elegant solution that can work for both core and custom interception points.
Hint Each execution point will have its own clean buffer to work with. As each interception point has finalized execution, the output buffer is flushed, only if content exists.
Here are some examples using the buffer
argument:
Here are some common methods on the buffer object:
append( str )
Append strings to the buffer
clear()
Clear the entire buffer
length()
Get size of the buffer
getString()
Get the entire string in the buffer
getBufferObject()
Get the actual java String Builder object