When enabling event caching in ACF2016 and adding the cache annotation to a handler method, the following error is thrown:
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
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.
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?
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.
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.
: 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.