• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Put and Post

 
Ramya Iyer
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can someone explain me this difference with a sample code that would help me understand it better?

Regards,
Ramya.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no similarity between Put and Post except both are not idempotent.

doPost() used to send data of unlimited length.
doPut() used to save a file to server.

Generally, we dont use doPut() method to save the file to the server. However, we use third party libs or custom lib to upload the file to the server. Most of the browsers doesn't use any rational thing for doPut() method. Hence, it is very difficult to find any example of that. For more information you can always refer to docs.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

There is no similarity between Put and Post except both are not idempotent.


I think PUT is idempotent, according to HTTP specs.

Thanks
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difference between Put and Post.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Narendra Dhande:
I think PUT is idempotent, according to HTTP specs.


Thanks Narendra. In Http Specs its mentioned as idempotent.

But java docs says:
doPut() method does not need to be either safe or idempotent. Operations that doPut performs can have side effects for which the user can be held accountable. When using this method, it may be useful to save a copy of the affected URL in temporary storage.

It mean its not-idempotent like doPost().

Thanks anyways.
[ December 22, 2005: Message edited by: Adeel Ansari ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found on more related thread.
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Operations that doPut performs can have side effects for which the user can be held accountable.


sounds like non-idempotent but actually idempotent.

Http Spec 1.1
[ December 22, 2005: Message edited by: Vishnu Prakash ]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In Sevlet specs though mentioned that doPost() should be non-idempotent, it is mostly depends on the methods implemented by us. we can also implement non-idempotent GET method.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic