You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kenk <ke...@earthlink.net> on 2008/06/03 17:34:54 UTC
RE: Is there such a thing as flash in S2?
Hi GB,
Did you ever find a place to post your FlashResult / FlashInterceptor? I'm
interested in doing the same thing -- though I understand and agree with the
disadvantage that Brad spoke of. Basically, I'm looking to do something
similar to the
http://www.stripesframework.org/display/stripes/State+Management Stripes
flash scope
Thanks in advance,
Ken
Guillaume Bilodeau wrote:
>
> Hi guys,
>
> I have just developed a FlashResult / FlashInterceptor pair - turns out
> ....
>
>
--
View this message in context: http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--tp16697840p17626450.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Is there such a thing as flash in S2?
Posted by Guillaume Bilodeau <gb...@yahoo.com>.
Great! I'm glad it worked fine. I'll merge your documentation additions as
soon as I have a moment, thanks for providing them.
I like your idea of generating multiple flash map IDs, it seems like a good
solution would make the implementation more flexible. Feel free to modify
the code and upload it here - again if I have some time I'll try to have a
look at it also.
As for setting a timeout value on the flash map, the idea's interesting but
I think it would only delay the problem. Sure putting a 60-second delay on
the map would allow it to survive to quick refreshes, but it wouldn't solve
the case when a user returns to this page later using the back button; plus
it would be possible to clog the session with long-lived flash maps if not
used correctly. On the other hand, maybe it would solve enough cases to
motivate adding this functionality; plus giving a choice to the developer
can be a good thing. Maybe the Struts2 seniors would like to give their
opinion on this?
To implement this I'd have the result add a timestamp to the map and the
interceptor check for the timestamp's validity instead of starting a timer
though, it would be much lighter.
Cheers,
GB
kenk wrote:
>
> GB,
>
> I've finished implementing my use case using your FlashInterceptor and
> FlashResult -- it worked perfectly and I didn't need to change anything in
> your code. :clap:
>
> But it did take me a while to achieve success, mainly owing to my newness
> to Struts 2 and the difficulty I've had following the S2 documentation.
> So having said that, I have uploaded some revisions to your JavaDocs, in
> hopes that they will help other newbies dealing with the whole flash scope
> issue, perhaps you can add these.
>
> The main feedback item I have on the code is the hard-coded "__flashMap"
> key on the session -- this limits you to one flash scope at a time. How
> about having the FlashResult generate a random key value ( i.e.
> __flashMap_xxxxx ), send this as a request parameter, have the
> FlashInterceptor detect this value and use it to access the map. Poof!
> No more issue with multiple browser windows open.
>
> For the refresh issue, have an optional configuration parameter on the
> FlashInterceptor called "flashMapTimeout", defaulting to 60 seconds.
> Instead of immediately removing the flash map from the session, start a
> java.util.Timer and remove it later. Poof! Now the refresh works (until
> the timeout occurs).
>
> Thanks again for making your code available!
> Ken
>
> http://www.nabble.com/file/p17659710/JavaDocAdditions.txt
> JavaDocAdditions.txt
>
--
View this message in context: http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--tp16697840p17670259.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Is there such a thing as flash in S2?
Posted by kenk <ke...@earthlink.net>.
GB,
I've finished implementing my use case using your FlashInterceptor and
FlashResult -- it worked perfectly and I didn't need to change anything in
your code. :clap:
But it did take me a while to achieve success, mainly owing to my newness to
Struts 2 and the difficulty I've had following the S2 documentation. So
having said that, I have uploaded some revisions to your JavaDocs, in hopes
that they will help other newbies dealing with the whole flash scope issue,
perhaps you can add these.
The main feedback item I have on the code is the hard-coded "__flashMap" key
on the session -- this limits you to one flash scope at a time. How about
having the FlashResult generate a random key value ( i.e. __flashMap_xxxxx
), send this as a request parameter, have the FlashInterceptor detect this
value and use it to access the map. Poof! No more issue with multiple
browser windows open.
For the refresh issue, have an optional configuration parameter on the
FlashInterceptor called "flashMapTimeout", defaulting to 60 seconds.
Instead of immediately removing the flash map from the session, start a
java.util.Timer and remove it later. Poof! Now the refresh works (until
the timeout occurs).
Thanks again for making your code available!
Ken
http://www.nabble.com/file/p17659710/JavaDocAdditions.txt
JavaDocAdditions.txt
--
View this message in context: http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--tp16697840p17659710.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Is there such a thing as flash in S2?
Posted by kenk <ke...@earthlink.net>.
Thanks GB. I'll try to respond back to this thread by friday or so. -- K
:working:
--
View this message in context: http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--tp16697840p17647498.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Is there such a thing as flash in S2?
Posted by Guillaume Bilodeau <gb...@yahoo.com>.
Hi Ken,
You can find the files and unit tests here:
https://issues.apache.org/struts/browse/WW-2635
Let me know how it works for you, as I couldn't give it extensive testing.
Cheers,
GB
kenk wrote:
>
> Hi GB,
>
> Did you ever find a place to post your FlashResult / FlashInterceptor?
> I'm interested in doing the same thing -- though I understand and agree
> with the disadvantage that Brad spoke of. Basically, I'm looking to do
> something similar to the
> http://www.stripesframework.org/display/stripes/State+Management Stripes
> flash scope
>
> Thanks in advance,
> Ken
>
>
> Guillaume Bilodeau wrote:
>>
>> Hi guys,
>>
>> I have just developed a FlashResult / FlashInterceptor pair - turns out
>> ....
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Is-there-such-a-thing-as-flash-in-S2--tp16697840p17629368.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org