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.
OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
subject: Is there a way to make a java web app to deal with multiple duplicate requests sent by users?