RE: [coldbox:16021] Interceptor and the request context

Rc is just a struct so it has no methods. Getvalue() only exists in the event object.
That being said, after configuration load is only called once after the app starts up. The rc is request-scoped, so it resets every request. Your interceptor would only set that value on the actual request that reinits the framework. If you want sure siteroot set on every request, try the preProcess interception point.

Brad

I would say the same thing as Brad.

hmm…

You are correct as usual Brad, if I change to preProcess, the “siteroot” variable now exists in the rc struct and works exactly as I wanted. I also get that afterConfigurationLoad would only be run once the first time the application is instantiated which means this code should work at least once OR, as I was thinking, anytime I push fwreinit through the URL…but that without those two conditions, “siteroot” would be lost on subsequent requests, thus making it the wrong place to do this.

That being said, “siteroot” does not exists on an fwreinit when the interception point is afterConfigurationLoad is reached and my interceptor fire.

Mike

The answer is knowing when the interception point is called, and the request context is not ready at that stage.

I swear I’m not trying to be difficult…I want to learn more about what’s under the hood so that I could have suggested an answer like this.

The problem is that the interceptor is not kicking any errors out. If the request context were not ready, wouldn’t the event object be unavailable too? And if not, say the event object is available but the rc in it was not, wouldn’t I be getting and error when I try to setValue?

I don’t think your trying to be difficult at all.

That’s actually a good question, and I am not sure either. I am wondering if the event handling is set up, but the request context is not. I am guessing here, so hopefully someone who might know for sure might pipe in.

I did try to google it, as I do recall either Brad or Aaron put together something, that showed the process of event and when things are available, but couldn’t find it.

Thanks. I’m digging through the documentation but so far not finding anything this granular. I should note, in particular with all the great help I’ve received trying to understand this, that the way I was trying to do this IS silly and originally began as a “shouldn’t I be able to” problem…then became “I’m not doing this quite right” and now on to a “I won’t likely do this anyway, but shouldn’t I be able to” issue. I was thinking you could even paint a “run once” scenario but since the start of the application or fwreinit would help with that, I don’t even think that makes any sense.

Mike

What you need is the request lifecycle: http://wiki.coldbox.org/wiki/RequestLifecycles.cfm

Looking at the MVC lifecycle the event no render has two yes arrows. Shouldn’t the one on the left be a no?

Yep you’re right – the one on the right should be a no…

I tired to add a comment on the wiki and no matter what I try for the captcha it doesn’t allow me to submit.