tracker issue : CF-4199825

select a category, or use search below
(searches all categories and all time range)

getPageContext().getResponse().getContentType() throws UnsupportedOperationException

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Bradley Wood / Bradley Wood ()

Created: 09/26/2017

Components: Installation/Config, JEE Deployment

Versions: 2016,2018

Failure Type: Others

Found In Build/Fixed In Build: 2016 / 312568

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Platforms All

Vote Count: 3

Problem Description:
getPageContext().getResponse().getContentType() throws UnsupportedOperationException

Adobe's coldfusion.jsp.ServletResponseWrapper class doesn't fully implement the spec for the ServletResonse interface and throws an exception from the getContentType() object.  This used to work in previous versions of CF, but was broken at some point in 2016.  

The ColdBox framework uses this with its event caching feature to see what content type has been set in the response.  Please implement the full javax.servlet.ServletResponse interface.

Note, the same issue is present with the setCharacterEncoding() method on the response wrapper.

Steps to Reproduce:

Actual Result:
at coldfusion.jsp.ServletResponseWrapper.getContentType(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at coldfusion.runtime.StructBean.invoke(
at coldfusion.runtime.CfJspPage._invoke(
at coldfusion.runtime.CfJspPage._invoke(
at cfBootstrap2ecfc1271759093$funcPROCESSCOLDBOXREQUEST.runFunction(/coldbox/system/Bootstrap.cfc:241)

Expected Result:
The actual content type of the servlet response to be returned.

Any Workarounds:
You can bypass Adobe's response wrapper like so, but this requires you to first check if you're dealing with a response wrapper at all.




This wasn't fixed in CF2016. I'm attempting to access getPageContext().getResponse().isCommitted() in order to determine if anything was flushed either automatically or forced. (isOutputAutoFlushed() doesn't return TRUE if something was flushed using CFFlush.) The fix is 312568. Where is that update available to all ColdFusion 2016 licensed users? The last version made publicly available appears to be 311399. Please advise so that this fix can be applied. (If never to the end users, this bug can't really be flagged as "fixed", can it?)
Comment by James M.
30115 | January 14, 2019 03:28:50 PM GMT
I'd like to see ColdFusion 2016 build 312568 released so that this bug can be resolved.
Vote by James M.
30116 | January 14, 2019 03:31:14 PM GMT
Adobe should adhere to the servlet spec and not hide things under their own implementation.
Vote by Evagoras C.
30146 | January 24, 2019 07:56:05 PM GMT