application and session scope do not require cfapplication tag!

They say you learn something new every day. Or maybe its that you should try to learn something new every day. Either way, its true for me! I was looking at some sample code in reactor today and noticed that a variable was being set in the applicaiton scope. I wanted to make sure it was reloaded, so I was going to try to go change the application name so i knew that it would happen. But I looked and looked and couldnt find the cfapplication tag.... I was under the impression that the application and session scopes required the cfapplication tag (or at least an application.cfc) but there was none and it was working... come to find out, this isnt required at all. It is going into some sort of non-named application scope and it works just fine. Now it is not something that I recomend by any means, it could cause some very subtle and hard to track down bugs, but it is possible. Did this change from a previous version? I could have sworn it was like this in the past at least... To prove it you can stick this in a new folder with no parrent application.cfm file... Should work just fine (at least on cf 7.0.1 with mystic beta...)

Posted on Mon. March 13, 2006 by Ryan Guill
 

1

Do you mean to say that one of the reactor samples uses the application scope without the cfapplication tag? I just searched through them and determined that it's not the contact manager because it doesn't use the application scope at all. Additonally, the blog has the cfapplication tag in the application.cfm. Can you give a little more detail?

Posted on Mon. September 15, 2008 by Doug Hughes #

2

Yes, it was the contact manager. I saw this: cfset ContactGateway = Application.Reactor.createGateway("Contact") / in the index.cfm (i took out the greater-than, less-than symbols) and in the application.cfm file I saw: cfset Application.Reactor = CreateObject("Component", "reactor.reactorFactory").init(expandPath(".") & "/reactor.xml") / but I did not see any cfapplication tag. The only reason I was even looking for it was that I didn't know how to manually refresh the application to make sure I had the newest reactor.xml file being used, so I was going to change the application name to force it to load again. Let me know if I need to be more detailed.

Posted on Mon. September 15, 2008 by Ryan Guill #

3

Ah ha. Apparently I had a case sensitive search on! :) Anyhow, that that's a bug in that sample. I'd planned on caching the reactor factory into the application scope but never finished. If you dont have an application tag you're just using a structure named application. Either that, or you have an application.cfm/cfc in your directory hierarchy.

Posted on Mon. September 15, 2008 by Doug Hughes #

4

Ah, that makes sense. I just thought that it threw an error before if you did that, although I may be mistaken.

Posted on Mon. September 15, 2008 by Ryan Guill #
Design, Photograph, Work © Ryan Guill, aDeepBlue 2013: All Rights Reserved. | Contact | RSS Feed