• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Idempotent request

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic