I have a struts web application that is giving me a problems. I recently came across a problem where if the user hit F5 multiple times it would cause an out of memory SQL exception. I found the issue and resolved the situation, however I want to ensure that this won't happen again even if something gets done incorrectly. I have been told that its possible to ignore the refresh if someone hits it multiple times in a short period. However, I can't seem to find any good documentation on how to do anything but disable the F5 button in IE and Firefox. Can someone help me with resources? Or Confirm that it simply isn't possible. I see a lot of mixed answers some indicating it is possible and then others that its not. I am under the impression that it can kind of sorta be done in certain browsers under specific situations, but nothing fool proof. Just trying to exhaust my resources before I give up on this one.
I dont know if it is possible to ignore refresh. But why not store a session attribute indicating no of times refreshed in a particular interval. If it exceeds threshold we can block the access. What wrong with this strategy?
Sorry to break this open again after a month. My first attempt was to simply decrease the number of SQL connections made to the database, but if the user hammers the refresh they can still reproduce the issue. I haven't been able to figure a good way to handle it on the client side, most of the internet seems to be struggling with resubmitting information through a form my problem comes when loading the page with information from the database. Gaurav if you had a link to some documentation that would better explain your suggestion I would appreciate it. I would like to do like Source Forge does, if you hit the refresh too many times too fast they deny you access to the server. Can that be handled by the application? Tomcat? Is that going to require a third party app?
Joined: Sep 21, 2010
Why not use the counter approach. Increase it till a threshold is reached within a small interval and if so then block access.
Okay so that works, I implemented something similar but instead of using a max interval I am storing a current time value then using a series of if statements to determine if my refresh cycle has expired. Seems to be working.