File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Idempotent request

 
ragunath selvaraj
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one explain abt the idempotent and non-idempotent request?

I cant understand the scenario explained in the Kathysieera jsp and servlets book ..page no is 109.
 
Deepak Jain
Ranch Hand
Posts: 637
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a good explanation Deepak

Also the link you have provided contains a very good information and clarifications from the bartenders and other ranchers! Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic