Update to Application.CFC Reference

There was a typo in the PDF. Thanks to Simeon for pointing it out. Link is the right Tools box. For those who may have missed yesterday's post - this PDF is a simple skeleton of a proper Application.cfc file. I created because I tend to forget what each method returns and what arguments they take.

Archived Comments

Comment 1 by Simeon posted on 2/25/2005 at 5:19 AM

Well to give accurate credit I must say that my eagle-eye friend Sean Corfield spotted the spelling mistake while we discussed why I couldn't get my session managment to work.

But thanks to Ray for the skeleton, and thanks to Sean for proving I was not crazy.

Comment 2 by John Farrar posted on 2/25/2005 at 7:25 AM

Let me ask again just to make sure. In the OnApplicationEnd you have the argument "applicationScope". In the OnSessionEnd you have the argument "appScope". Shouldn't the naming of the scopes be consistant? (just for general coding practices... noticed it because I am used to people pointing this type of thing out for me.)

Comment 3 by Raymond Camden posted on 2/25/2005 at 8:17 AM

John: The name of the argument is totally up to you. However, you are right, the naming should be consistent. I'll do another update tomorrow morninig.

Comment 4 by Marcus C. posted on 3/1/2005 at 1:00 AM

Weird..the onRequest method in the application.cfc will not show the page in the browser. No error/debug message, just a blank page. If I take this method out, the page shows fine. Not sure what the problem is.

Comment 5 by Raymond Camden posted on 3/1/2005 at 1:09 AM

Are you using the exact same code from the PDF?

Comment 6 by Marcus C. posted on 3/1/2005 at 3:15 AM

Yes I am, the exact same code. I even commented out several of the methods I not using yet. I only have
onApplicationStart, onApplicationEnd, and onRequest enabled (no commented out) and I get a blank page. When I comment out the onRequest method the page opens (has errors but opens). I want to include some udfs in this methods otherwise I would just leave it out. Thanks!

Comment 7 by Marcus C. posted on 3/1/2005 at 3:16 AM

Sorry meant to say: I only have onApplicationStart, onApplicationEnd, and onRequest enabled (the other methods are commented out)..

Comment 8 by Raymond Camden posted on 3/1/2005 at 3:20 AM

Did you get the _latest_ copy? I had a typo that caused an error to fire. Since onError is blank, the error got supressed. Try the latest copy. If it doesn't help, try outputting the errors in onError and see if it makes sense.

Comment 9 by Marcus C. posted on 3/1/2005 at 3:22 AM

Sorry meant to say: I only have onApplicationStart, onApplicationEnd, and onRequest enabled (the other methods are commented out)..

Comment 10 by Marcus C. posted on 3/1/2005 at 6:37 AM

Sorry meant to say: I only have onApplicationStart, onApplicationEnd, and onRequest enabled (the other methods are commented out)..

Comment 11 by Marcus C. posted on 3/1/2005 at 7:13 AM

That did it. Guess I didn't have latest copy. Thanks for the great document!

Comment 12 by Crit posted on 3/10/2005 at 11:01 AM

i'm having the same issue... i just copied the pdf and threw it into an Application.cfc file in the root of my app, but no pages appear at all... any suggestions?

Comment 13 by Raymond Camden posted on 3/10/2005 at 7:44 PM

Turn on debugging and see if onError is being run. Since my onError is empty, you won't see anything. You should modify it for now to cfdump the exception. Also be 100% sure you get the latest PDF as the first version had a typo.

Comment 14 by Critter posted on 3/10/2005 at 7:57 PM

I did find an error, it was from code i had commented out. now I get a:

Unable to complete CFML to Java translation.
Error information unsupported statement: class
coldfusion.compiler.ASTfunctionDefinition

for code that works when it's in my application.cfm. I've posted it to cf-talk as well.

Comment 15 by William posted on 6/16/2005 at 1:30 AM

Just wanted to say thanks. Having a reference from a CF engineer helps with "best practices" scenarios. I don't need to cut-and-paste anything here, but to see the framework certainly helps me out a great deal. Thanks again. :)

Comment 16 by Bruce Trevarthen posted on 8/8/2005 at 6:30 AM

I got annoyed with the use of CFABORT causing errors to be thrown and displayed all the time so I wrapped the outputs of my onError method in the following:

<cfif NOT Find("AbortTag.doStartTag",Arguments.Except.RootCause.StackTrace)>..logging and display output..</cfif>

Now I only see real errors.