• 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

Put and Post

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Difference between Put and Post.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found on more related thread.
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic