Re: Saving messages in the session
It does come up, especially when people are using frames. I usually recommend that people use an Action to cache the messages in the session during the redirect and then have another Action to move it back again afterwards. It might be possible to engineer a standard Action to automate this sort of thing. It seems to me to be a workflow issue. People want to put the attribute into the session so that it survives a redirect, but we all want to see some assurance that it will be disposed afterward. The big fix might be to consider adopting Matthias Bauer's Workflow plugin, which could be used to enforce these types of contracts. But, it would be better to do that in the 1.4.x timeframe, when the new RequestProcessor might be on board. -Ted. Robert Leland wrote: Use Cases: I am not familar with the particular use cases where the ActionMessage needs to hang around in the session. So these suggestions might not fit. Questions: Would managing the life cycle through the struts-config.xml, like the ActionForm work ? or How about a PlugIn that has the ability to schedule a cleanup of a session variable after a configurable amount of time ? The method that reads the message from the session would need to be syncronized. This doesn't have to be a plugin. -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Junit in Action - http://www.manning.com/massol/, Struts in Action - http://husted.com/struts/book.html, JSP Site Design - http://www.amazon.com/exec/obidos/ISBN=1861005512. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Saving messages in the session
--- Robert Leland [EMAIL PROTECTED] wrote: Use Cases: I am not familar with the particular use cases where the ActionMessage needs to hang around in the session. So these suggestions might not fit. The main reason I've seen on the user list (and the reason I need it) is to redirect to a success/error page and display messages. Storing them in the request only works for forwards. Questions: Would managing the life cycle through the struts-config.xml, like the ActionForm work ? Maybe, do you have more details on this idea? or How about a PlugIn that has the ability to schedule a cleanup of a session variable after a configurable amount of time ? The method that reads the message from the session would need to be syncronized. This doesn't have to be a plugin. This gave me a different idea. What if the ActionMessages had a used flag that is set to true the first time its messages are accessed. The RequestProcessor would have a new processCachedMessages method that would check the flag and remove from the session as needed. This seems more responsive than a periodic cleanup and we wouldn't have to cache HttpSession objects which may not be safe/legal. Also, I think placing the cleanup in the RequestProcessor guarantees that it is performed rather than relying on Actions to do the cleanup. Comments? David -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Saving messages in the session
David Graham wrote: --- Robert Leland [EMAIL PROTECTED] wrote: Use Cases: I am not familar with the particular use cases where the ActionMessage needs to hang around in the session. So these suggestions might not fit. The main reason I've seen on the user list (and the reason I need it) is to redirect to a success/error page and display messages. Storing them in the request only works for forwards. Questions: Would managing the life cycle through the struts-config.xml, like the ActionForm work ? Maybe, do you have more details on this idea? or How about a PlugIn that has the ability to schedule a cleanup of a session variable after a configurable amount of time ? The method that reads the message from the session would need to be syncronized. This doesn't have to be a plugin. This gave me a different idea. What if the ActionMessages had a used flag that is set to true the first time its messages are accessed. The RequestProcessor would have a new processCachedMessages method that would check the flag and remove from the session as needed. This seems more responsive than a periodic cleanup and we wouldn't have to cache HttpSession objects which may not be safe/legal. Also, I think placing the cleanup in the RequestProcessor guarantees that it is performed rather than relying on Actions to do the cleanup. That is MUCH simpler and RESPONSIVE than the scheduler ! So we are consistent on the 'state' flag names like -used- Bug 18022, talked about wrapping the ActionForm with another class when it was returned from the createActionForm method. It would have two attributes: -recycled-, and ActionForm. It would be nice if the terms -used-, and -recycled- fit a theme. Since the code hasn't been written yet, your at liberty to pick that theme. -Rob Comments? David -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Saving messages in the session
-Original Message- From: David Graham [mailto:[EMAIL PROTECTED] ... This seems more responsive than a periodic cleanup and we wouldn't have to cache HttpSession objects which may not be safe/legal. Also, I think placing the cleanup in the RequestProcessor guarantees that it is performed rather than relying on Actions to do the cleanup. +1 Comments? you read my mind :-) Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Saving messages in the session
So we are consistent on the 'state' flag names like -used- Bug 18022, talked about wrapping the ActionForm with another class when it was returned from the createActionForm method. It would have two attributes: -recycled-, and ActionForm. It would be nice if the terms -used-, and -recycled- fit a theme. Since the code hasn't been written yet, your at liberty to pick that theme. I disagree with the proposed solution to 18022 but, regardless, I don't see the connection between these two situations. Maybe I'm not viewing it correctly but recycled doesn't seem to fit the ActionMessages use case. Commons Resources' MessageList will need a new method so I decided to go with isAccessed() instead of isUsed(). I'm not particulary attached to that name so anyone with a better one should speak up :-). Once we settle on a name I'll add it to MessageList. I added RequestProcessor.processCachedMessages() to do the cleanup. I wasn't sure of the best place to call it so I called it right after processPreprocess so that it does the cleanup after pre-processing but before everything else. Again, if there's a better name for this method or better place to call it please chime in with suggestions. David -Rob Comments? David -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Saving messages in the session
Use Cases: I am not familar with the particular use cases where the ActionMessage needs to hang around in the session. So these suggestions might not fit. Questions: Would managing the life cycle through the struts-config.xml, like the ActionForm work ? or How about a PlugIn that has the ability to schedule a cleanup of a session variable after a configurable amount of time ? The method that reads the message from the session would need to be syncronized. This doesn't have to be a plugin. -Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]