RE: [coldbox:4373] MessageBox Plugin

Luis, there are two different scenarios where Flash Ram for the message box plugin is behaving differently for us. Allow me to explain.

The first problem is that Flash Ram appears to only persists data for the very next request and no longer.

Consider the following hypothetical situation:
Event A sets message box message, redirects to event B
Event B, redriects to event C
Event C, renders view normally.

Note that if I am calling getPlugin(“messagebox”).renderit() in my layout, but event A and B redirect in the handler, renderit() won’t be called until Event C.

In the previous version of messageBox, the message box plugin itself was responsible for clearing out the session data once it was finished using it. That ensured that the message set in Event A was still around for Event C once renderit() actually got called.

However, now the message box struct only stays around for one redirect and then gets cleared whether or not it ever actually got displayed.

The second issue we are seeing with the message box plugin is related to a custom interceptor I have listening on afterAspectsLoad. It sets a simple message box message saying “Application #getSetting(‘AppName’)# Reinitialized on server #server.hostName#.” It’s handy to ensure that I typed fwreinit correct and am on the right server, etc. However, now the flash ram seems to be getting cleared out when the requestService inflates the flash ram to the rc with inflateFlash() which, in turn, calls clearFlash() at the end. This means my message box message set in the afterAspectsLoad interceptor appears to get wiped out before the request even begins.

I tried to trace through when and how the “keep” flag gets set in the AbstractFlashScope and SessionFlash but I couldn’t really figure anything out.

The long and short of it I think is that the behavior of the messageBox plugin has changed in that messages sometimes get deleted prior to being displayed instead of hanging out in session until renderIt() gets called.

~Brad

The first problem is that Flash Ram appears to only persists data for the very next request and no longer.

Yes, this is the behavior of the flash RAM. It should persist ONLY to the next request. However….

In the previous version of messageBox, the message box plugin itself was responsible for clearing out the session data once it was finished using it. That ensured that the message set in Event A was still around for Event C once renderit() actually got called.

I know see what you mean, which is different from the old behavior, in which the data stayed around until it was displayed and removed. Ok, I will have to rethink the messagebox approach as I would like the functionality of what you mention to remain and still leverage the use of flash scope. Any ideas?

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Any ideas?

I think the only solution would be to modify the “keep” flag or add another flag to the flash scope that indicated an item stayed around until specifically marked for removal. Of course, at this point I’d have to ask if session storage wasn’t really the best place for this data in the first placed based on how we wish to define its behavior. Is there a particular reason to store the message box data in flash?

~Brad

The reason to store in flash, was to have a unified interface to store data across requests. So you could easily just switch the flash RAM to another provider and everything would respond to it.

So I still find a preference for the flash RAM, but yes, maybe adding another flag for leveraging the autoclean features of it. So maybe a flag called: autoClean = true by default, or if you want to be responsible for cleaning out the data you do autoClean=false and it will be your job to handle the cleanup, which I kinda like to tell you the truth?

Ideas?

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com