How do I reset application.cfc without resetting the server instance?

Dan Sorensen picture Dan Sorensen · Dec 14, 2009 · Viewed 7.2k times · Source

Possible Duplicate:
restart application without restarting server?

How do I reset a Coldfusion Application / application.cfc without resetting the Coldfusion Server instance? If I remember right, there are a few tricks out there such as creating a reinit function within application.cfc or renaming the file.

Answer

Goyuix picture Goyuix · Dec 14, 2009

A couple of steps:

First, make sure all your application initialization logic is contained inside the OnApplicationStart method of your CFC. If it has nested calls, that is fine - just so long as you can re-initialize your application easily through a single call makes your life much easier.

Second, this is the code I use in the OnRequestStart method of application.cfc

<cfif structKeyExists(url,'resetappvars')>
  <cfset OnApplicationStart() />
</cfif>

Feel free to use whatever coded value you would like in place of resetAppVars.