Setting application variables in onRequestStart???

LEGEND ,
May 02, 2016 May 02, 2016

Copy link to clipboard

Copied

Hello, all,

I'm working on some legacy code that I inherited from a long-gone developer (he left about two years ago.)

For some reason, the developer is setting application variables in the onRequestStart() section of application.cfc.

I was under the impression that application variables were set when the server is first started, or comes back from a reboot, or similar situation.  Yet until recently, this application was running without a hitch.

Am I crazy?  Obviously the variables are working, but I didn't think it would.

V/r,

^_^

Views

209

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 02, 2016 May 02, 2016

Copy link to clipboard

Copied

Application variables can be set anywhere in your application, including in .CFM files. You might be thinking of the this scope in Application.cfc, which can only be set in the pseudo-constructor portion of Application.cfc.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 02, 2016 May 02, 2016

Copy link to clipboard

Copied

Hi, Carl,

Okay.  I just thought that anything set in the application scope would be ignored unless/until a reboot or reinit.  I just never saw anyone set application variables like that, before.  But, if it works..

V/r,

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

I recommend that you read the Developing CFML Applications -> About Applications section of the "Developing ColdFusion Applications" document linked on the ColdFusion Help page. It contains important concepts that you need to understand about the application scope.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 03, 2016 May 03, 2016

Copy link to clipboard

Copied

LATEST

P.S. To answer your question, yes, you're crazy.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines