> In the application.cfm I write the following:
> 
> <CFSET APPLICATION.webroot = "http://www.mysite.com";>
> 
> Then I call this on certain pages in the application, 
> such as: <CFOUTPUT>#APPLICATION.webroot#</CFOUTPUT>
> 
> My question is this:
> 
> 1) Do I need to use locks around everytime I call this 
> APPLICATION variable?

Well, the generic recommendation I give in this situation is, yes, you must
lock every instance of any memory variable. There are those who disagree,
specifically with Application or Server variables, who will argue that as
long as the variable is locked, and only written to once, there shouldn't be
any problem. In my opinion, I'd rather be safe than sorry, since memory
variables have caused enough trouble in applications I've seen.

> 2) Can I get away with using a REQUEST variable instead of 
> APPLICATION variable when I write CFSET commands, such as 
> (I know I can do REQUEST variables for calling DSN connections):
> 
> <CFSET REQUEST.webroot = "http://www.mysite.com";> then
> <CFOUTPUT>#REQUEST.webroot#</CFOUTPUT>

Yes, not only can you "get away with it", but in the case of variables which
are essentially static through the lifespan of the application - datasource
names, file paths, and the like - I'd strongly recommend that you use either
the Request or the local Variables scope and simply set these variables in
Application.cfm.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to