Question about application.cfc. In my constructor section, I have the standard:
My question: How do you reference those variables outside the CFC? Say for example I wanted to refer to the "name" variable set above for some reason. Dumping the Application scope doesnt show those variables. Dumping the "This" scope doesnt work (the This scope doesnt work outside the CFC).
Turns out Tim had a simple misunderstanding. He followed up his original question saying he was doing this:
His mistake was that he was using the This scope for Application data. The This scope, in terms of Application.cfc, is for Application settings, not data. Basically - remember all the attributes you used to pass to the CFAPPLICATION tag? That's what we're talking about here. The This scope simply turns on or off various features of ColdFusion applications. For Application data, do what you did in the past - use the Application scope.
That being said, how do you go about getting the settings? The name of the application is always available in the application scope using the ApplicationName key:
The other settins are not directly available. You can, for example, determine if the session scope is turned on using a try/catch statement. There is even a UDF for this.
Another thing to remember is - all variables set in the This scope are available from an instance of the component. You can do this:
The structKeyList will show all members of the This scope. You could then check to see if SessionManagement is turned on, as well as other settings.