Possible issue when using Flash inside an interceptor

I just switched over from using sessionStorage to using the flash for one of my modules, so that I could use other scopes if needed.

Anyway inside an interceptor I am seeing flash as a empty string, so the following

flash.put(“myKey”,“myvalue”);

Ends up throwing a method doesn’t exist type of error, if I dump the flash and abort the processing, I end up seeing an empty string.

According to the docs on FlashRam, the interceptor is supposed to have this available and the code seems to support this. However it is 100% empty for some reason.

Any clues?

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/113032480415921517411

Where in the application lifecycle are you trying to use Flash Ram? If you try too early, the request service isn’t initialized and the variable that holds the flash RAM object is still a “0”. See line 25 of RequestService.cfc. It’s not initialized until onConfigurationLoad() is called.

For the life of me I can’t remember where, but I ran into this somewhere else. We should probably put in a check or something in getFlashScope().

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Inside an interceptor, the docs say I can, but it is empty.

What is the interception point? More specifically, does it fire before onConfigurationLoad?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

It is preProcess() and are you sure its onConfigurationLoad() as there is nothing in there that sets the flash scope.

Hmm, preProcess should be fine. Can you provide a stack trace or some code?

The RequestService creates the flash scope on line 68 in its onConfigurationLoad method. It has to wait until then since the storage location is a setting.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

No idea what RequestService you’re looking at Brad, but the flash is built when the application loader is run, where it then runs buildFlashScope which is not where you say it is.

Stack trace here would not help, if it is empty it is empty…

What version of ColdBox are you running? Right here in master:

https://github.com/ColdBox/coldbox-platform/blob/master/system/web/services/RequestService.cfc#L68

I’m not sure why you don’t think a stack trace would be useful. It’s important to determine where in the request/application lifecycle the flash scope is being accessed.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

The version of ColdBox that comes with the latest ContentBox.

Because the first error is the flash error, and as it is an interceptor that is just setting to an empty string, I fail to see how the stack trace is going to show anything more.

As I said if I dump flash it is an empty string, so of course a method not found is going to occur. And the stack trace is not going to show anything more on that.