Event Caching Error in ACF2016 due to ACF bad implementation of HTTP Servlet Reponse

Description

When enabling event caching in ACF2016 and adding the cache annotation to a handler method, the following error is thrown:

{{
java.lang.UnsupportedOperationException
at coldfusion.jsp.ServletResponseWrapper.getContentType(ServletResponseWrapper.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at coldfusion.runtime.StructBean.invoke(StructBean.java:508)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:3168)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:3068)
at cfBootstrap2ecfc1271759093$funcPROCESSCOLDBOXREQUEST.runFunction(/coldbox/system/Bootstrap.cfc:241)
}}

Line 241 (current release) of coldbox.system.Bootstrap calls getPageContext().getResponse() for the contentType key in the cache entry.

On ACF2016, the getPageContext().getResponse() call returns the Java object coldfusion.jsp.JspWriterIncludeResponse, but no method named getContentType() is available for this object.

This is a blocker due to the fact that ACF2016 Coldbox applications will fail if event caching is implemented.

Activity

Show:
Brad Wood
September 26, 2017, 1:37 PM

Ouch are we not using a documented method that's part of the Java spec? Is there a reason we're even dipping down into Java for that? Doesn't ColdFusion report the content type?

Jon Clausen
September 26, 2017, 2:05 PM

I was trying to find the method that would pull it this morning, but I couldn't find a native CF method. Maybe greater minds than I will prevail. The problem is that this arg is passed in to a `Content-Type` header downstream of the cache retrieval, so it seems dependent on the `/`-delimited format ( e.g. text/html ). With formats detection on Coldbox treats the `rc.format` value as a single, non-delimited, string ( e.g. `json` ).

This means that line can't use just `event.getValue( "format", "html" )`, it has to use a suitable `Content-Type` header value.

Jon Clausen
September 26, 2017, 2:07 PM
Edited

Also, why is markdown not enabled for the text fields in this project? https://www.atlassian.com/blog/archives/markdown-support-for-jira

Brad Wood
September 26, 2017, 3:52 PM

Ahh, so if you basically set a content type for the response that's currently being returned to the client then there's no CF way to get that. That makes sense, but I'm still confused as to why the method wouldn't exist. I'd need to review the Java docs but I would expect any subclasses to still expose the same method so long as it's part of the J2EE HTTPServletResponse spec. I wonder if 2016 is on a new version of the spec, or if the method signature has changed.

Jon Clausen
September 26, 2017, 4:29 PM

: Any ideas on how we can fix the implementation of this without breaking backwards compat? This is a blocker for using event-level caching on ACF currently and should probably be fast-tracked as a patch to the master.

Fixed

Assignee

Luis Majano

Reporter

Jon Clausen

Labels

None

Components

Fix versions

Priority

Blocker
Configure