This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello everyone, sooner or later every interactive web site has to deal with the problem of unexpected/unwanted double requests. These double (or triple, ...) requests occur when a user performs a Windows-style double click on a link or a submit button. They can also be caused by network problems and browsers/proxies that repeat the last request after a given timeout. The problem with double requests is when they execute an action that changes the persistant state of the application. An action to delete a mail from a folder will delete the mail on the first request and then throw an exception on the second request because the mail can't be found any more. One common solution to this is to deal with it in the business logic: If you try to delete an non-existing object, just silently return and do not throw an exception. On the other hand, the business logic tier should not know about the shortcomings of the transport protocol (presentation tier). Is there any "best practices" solution? I am thinking about implementing a servlet filter that allows the following: Each action that is known to cause problems needs to be appended by a special parameter that should probably be pseudo-random, but could also be a sequenced number. The parameter needs to be embedded in the href attribute of a link or as a hidden field in a form. The filter is executed very early in the filter chain, detects the parameter and blocks all other requests with the same random id until the first one returns. All blocked requests will not be delegated down the filter chain but will return with a copy of the first request's response. Additionaly, the response is associated with the random id in a hashtable for at least 5 minutes, and each late arriving request with an existing id also returns the pre-generated response. What do you think about it? Has this already been implemented somewhere? Regards, Andreas
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com