This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Scenario is: let's say a user submits a request to purchase a book from an online book store. response was slow due to ... .
the user thought the web app didn't get the request. the user clicks submit button again. now the web app receives the exact same
is there a way to make a java web app to deal with multiple duplicate requests sent by user?
in other word, how to make a java web app idempotent?
It's an universal problem - not only related to the Java. If you are not using sessions or HTTPS, the web server (HTTP) is stateless, so it doesn't have a clue if you executed the request before or not.
You can implement your own mechanism based on sessions to prevent such actions. I.e. you could put some attribute into the user's session which will mean that the user cannot execute the same action within, let's say, 2 minutes.