Ticket #389 (new defect)
ColdFusion 9's new "Cache Template in Request" admin setting breaks event generation
| Reported by: | cfgrok | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Version: | 3.1.185 | Severity: | normal |
| Keywords: | event-generation | Cc: |
Description
ColdFusion 9 has added a new caching setting, Cache Template in Request, which is enabled by default. When enabled, this setting breaks event generation, as it causes the invocation of the newly-generated message-listener function in the controller CFC to fail with a method not found error.
This occurs because a controller CFC will be cached for the duration of the request, and controllers are instantiated before new functions are generated, thus causing an error when a newly-generated method is invoked.
In order to completely work around this problem, there are two requirements:
- The event generation pass would need to be moved before module loading in the framework's initialization process, and this would require a new method to test for the presence of an event-handler, as the generation controller presently uses getModelGlue().hasEventHandler() to check for an existing event, and this method will not work prior to module loading
- The controllerHasFunction() method in the XMLEventGenerationService CFC would need to be rewritten to avoid the use of the getMetadata() function, as this also causes a CFC to be cached in the request, as does the getComponentMetadata() function
An alternative approach was proposed on the MG mailing list by Elliott Sprehn -- he suggested redirecting back the the same event after the generation pass completes, thus circumventing the caching issue. This does indeed work to prevent the error from occurring, with the trade-offs being a bit of additional overhead from a second request, and the loss of the debugging information regarding the generated event.
![(please configure the [header_logo] section in trac.ini)](/ModelGlue.com/trac.cgi/chrome/site/your_project_logo.png)