aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes (idempotent (GET, HEAD, etc)/NON idempotent(POST, PUT, etc.) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "(idempotent (GET, HEAD, etc)/NON idempotent(POST, PUT, etc.)" Watch "(idempotent (GET, HEAD, etc)/NON idempotent(POST, PUT, etc.)" New topic
Author

(idempotent (GET, HEAD, etc)/NON idempotent(POST, PUT, etc.)

samdeep aarzoo
Ranch Hand

Joined: Jun 09, 2005
Posts: 160
Difference between idempotent (GET, HEAD, etc) and NON idempotent(POST, PUT, etc.) ???

can anybody help me
Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Hi,

My guess is that you are really asking what idempotent really means.
www.dictionay.com -> idempotent
Acting as if used only once, even if used multiple times


What this really means is the methods GET, HEAD, etc should not make changes that will cause a second identical request (for the same user in the same session) to display different information, ie update the database.

Methods such as Post and PUT are not expected to be idempotent, that is two identical requests (from the same user in the same session) may result in different results being displayed to the user.

To put this another way adding an item to a shopping cart is not an idempotent request as it changes information curical to the user. Where as viewing the contents of the shopping cart should not change the contents of the shopping cart as it therefore an idempotent request.

Hope this helps

Mat
samdeep aarzoo
Ranch Hand

Joined: Jun 09, 2005
Posts: 160
thanks williams
Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
I read in the book, that POST was the only idempotent HTTP METHOD type.

I am not sure if PUT is also idempotent.
Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Not sure why I added Put - it is an idempotent method (or its supposed to be)

see this for the w3c take on idempotent methods
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Mat
Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
Logically speaking,
all POST, PUT and DELETE should be idempotent, but from the perspective of the certification, possibly the book assumption should be correct.

PUT and DELETE could have effect, like putting a file or deleting a resource. The second time you do the same operation, it would possibly throw a warning that either resource is already present or not there.
Alexandre Cervieri
Greenhorn

Joined: Aug 02, 2005
Posts: 27
Hello,
Considering PUT and DELETE, reading the page Mat Williams mentioned make me think that the server should not warn the user if the file to be PUT is already there or the file to be DELETEd is not there anymore. It should be transparent because these methods are also considered idempotent.

I think that for GET and HEAD we have an agreement that they are idempotent. Request a HEAD the N-time for a file should have the exactly result that requesting the HEAD for the same file at the first time.

However, about POST, I don't agree with you. POST is not idempotent. For example, if you have a HTML Form for insert a person in the database. The first time you submit the form that record will be inserted in the database. The second time you submit the form you will get a duplicate key exception (or something like that). And we may find other similar examples.
Regars,
Alexandre
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: (idempotent (GET, HEAD, etc)/NON idempotent(POST, PUT, etc.)
 
Similar Threads
To authors of HFS
idempotenet or NOT
IDEMPOTENT or not ?
Why PUT is idempotent ?
IDEMPOTENT and NON-IDEMPOTENT