• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is Put and Delete Idempotent

 
Venkat Perumalla
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team,
If Put method is used to put(body) at the Requested URL which means it performs some DB related stuff to add the content to the requested URL, can you please explain me how it can be idempotent.

and also about Delete method

Thanks in Advance ..........!!!
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
The idompotent methods are
1-Get
2-Put
3-Delete
4-Trace

Idempotent means that is this is happened more than once, it will has the same effect.

Regarding your question about the put method,the put method is not used to store records in the database,it is meant to put files to the server (upload file to a server).So you put the same file twice it will be replaced and the same effect will be acheived.This is the same case for Delete and Trace.

Get method is considered idempotent so you should not put any code that alters the database in a doGet method.

What is really idempotent is all about (This is the most important point)?
I remember i read in a book called "HTTP the definitive guide" and talked about the idempotency issue in detail in here is the abstract:
You know that Http architecture is request/response.
When you submit the data of a get form,the browser will open a TCP connection with the client and send the request.After the browser sends the request it will wait for the response to come back from the server via and TCP connection.If for somehow the response did not get to the client (for example,network problems) the browser will resend the get request
again.The browser will send requests only if the method type is get,put,delete,trace' and it will not do so for post.

The book HTTP The definitive is really a very helpful book and advice everyone to read this book.

Hope this info is useful
 
Venkat Perumalla
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kalid for your clear explanation, One more small clarification
But the time stamp varies for the File which is to be kept in the Requested URL while considering doPut() mehtod,
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i dont know about timestamps you mentioned.But even if they changed,say for example the file will be stored on the server at a different date.What migh differ is the creation date of the file.The contents will not be affected.You put the file the first time.Then you put the file the second time...etc.The only thing that might change is the creationTime property of the file.The contents will always be the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic