Curt
Sent from my U.S. Cellular Android device
Problem:
Application.cfc:
The errors are:
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
The proxy still goes via application.cfc so it seems weird
Sent from my iPhone
I also needed this to work when the app reinits through the deploy
interceptor so here's my proof of concept if anyone is interest. It's
a little cumbersome but it is working although I'm open to feedback.
1. In my custom deploy interceptor (based on the core one), I set the
following values in my "preProcess.
application.maintFlag = true;
application.maintFlagFromDeploy = true;
// Reload ColdBox
getController().setColdboxInitiated(false);
getController().setAspectsInitiated(false);
"maintFlag" flag is set to true because this is what happens on
"preReinit" but that interception point isn't going to fire when using
the deploy interceptor.
"maintFlagFromDeploy" is a flag that lets me know that the deploy
interceptor is causing a reinit.
2. In application.cfc, both of the values above are set to false in
onApplicationStart like in ken's example. But my onRequestStart looks
something like below. In addition ken's checks, I add an additional
check to see if "maintFlagFromDeploy" is true. If it is, allow that
request to go process and then set the value to false so that other
requests will not process and instead show the nice message in the
cfelse.
<cfif application.maintFlagFromDeploy
OR (NOT application.maintFlag
OR (application.maintFlag
AND isDefined("url.fwreinit")
)
)>
<cfset application.maintFlagFromDeploy = false>
<!--- Reload Checks --->
<cfset application.cbBootstrap.reloadChecks()>
<!--- Process A ColdBox Request Only --->
<cfif findNoCase('index.cfm', listLast(arguments.targetPage, '/'))>
<cfset application.cbBootstrap.processColdBoxRequest()>
</cfif>
<cfelse>
<!--- Show a nice message. We'll be right back after reinit --->
</cfif>
3. The deploy interceptor works in 2 requests as far as I understand
it. In the first request, coldboxinitated and aspectasinitiated is set
to false. In the second request, it reinits.
For my changes, I set my two application values in the deploy
interceptor to true in the first request. In the second request, it
sees that "maintFlagFromDeploy" is true, allows the request to
continue processing, and then immediately sets it to false so other
requests don't process.
Recall that the deploy interceptor works across 2 requests. So if I
only set "maintFlag" in the first deploy request, then my app will
always display the "nice message" and never reinit because "maintFlag"
= true in the second request of a deploy always goes into the "nice
message.". This is why I used a second value of "maintFlagFromDeploy"
to say: "I know we're currently reiniting, but you need to let this
request through". That request being the second one involved in the
deploy process.
- Gabriel