Hey, Let me also give it shot This will be my first post to SCWCD forum am gearing up for SCWCD, Behold
Idempotent: Multiple request to a servlet with same parameters must not have side effects on server. Is it good to be idempotent: Yes.
GET: HTTP SPEC says that GET is idempotent. GET must be used to GET things from the server. Although it can be used to update data on the server. Ideally it should be used to get things from the server. Since this is what GET is supposed to be used GET SAME THINGS again and again from server will never cause any side effects on the server. And hence GET is considered to be idempotent.
POST: HTTP SPEC says that POST is not idempotent. POST must be used when you want to update the server and hence it can become non-idempotent that is multple same requests can cause side effects on the server.
Now coming to the side effect: In HF book when the client makes the second request considering the first request did not reach the server, the container will simply think that the client wants to buy the same book again and will cause the transaction to happen, But the client did not want to buy the same book again, the client made the request assuming that the first request did not reach the server. So now there is problem. And these problems must be handled by the developer.
Although GET is considered to be idempotent there is nobody stopping the dev to implement a non-idempotent doGET(). This must be avoided.Ideally get must be used to get the data from the server. So the developer must make sure that while implementing doPOST() and doGET() methods he handles idempotency properly or else it will cause issues. Hope this clears.
Have a look here as well Idempotent [ January 12, 2008: Message edited by: Deepak Jain ]
[ January 12, 2008: Message edited by: Deepak Jain ] [ January 12, 2008: Message edited by: Deepak Jain ]