ColdFusion 11: Changing Application “this” Scope metadata from different functions in extended Application.cfc

北慕城南 提交于 2019-12-14 03:53:26

问题


I have a general understanding of the ColdFusion Application Workflow. But some parts remain unclear to me. The general workflow is as follows...

  1. Public Application Settings are set (I.E this.name, this.mappings ext.)
  2. onApplicationStart
  3. onSessionStart
  4. onRequestStart

I have a sub-directory with an Application.cfc that extends a root Application.cfc that exists at the web-root

After reading tons of blogs that describe this design pattern....

  • ColdFusion Application-Specific Mappings Work With CFInclude
  • Extending The Application.cfc ColdFusion Framework Component With A Relative-Path Proxy

  • Extending OnSessionStart() In A Sub Directory Application.cfc

  • application cfc-when-things-run

  • ColdFusion Application.cfc - order of execution

In the last link (some answers offer some basic insight,but none really touch on using this scope with an extended Application.cfc . One of the the following answer throws me off..(it might not be correct as no upvotes)

Anything in the this scope inside an Application.cfc file becomes an application varialbe and is only created ONCE per application life cycle. After the application starts, there is no other user for this within Application.cfc

I dumped the #application# scope and it is different then #this#

getApplicationMetaData() seems to dumps the same data <cfdump var=#this#> so im guessing thisMetadata is the global config variables initially set.

1) If the Application.cfc is extending a root Application.cfc using a proxy, is thethis scope (used to set name of application ) shared by extended components? (If I set this.name = "root" in the root component and this.name = "user"in the derived one, does cold fusion see this as two different applications or is the only effect that simply the value of the application name changes?

2) Is there anyway to change the Application MetaData on the this scope in any of the Applicaiton.cfc functions post psudo constructor (onApplicationStart ,onSessionStart ,onRequestStart)?

I'm looking at trying to set the application specific mappings in the the root component using the onApplicationStart() so that the mappings are only set once.

来源:https://stackoverflow.com/questions/48157713/coldfusion-11-changing-application-this-scope-metadata-from-different-functio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!