It's not a secret anymore!*
The moose likes Servlets and the fly likes Idempotent??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Idempotent???" Watch "Idempotent???" New topic
Author

Idempotent???

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
What exactly is Idempotent, which method is idempodent and which is not and how and why?

Thanks.
Nila dhan
Ranch Hand

Joined: Sep 15, 2005
Posts: 160
idempotent is something(for eg a resource) which is not changed or modified in any case.The Get method is idempotent whereas the post method is not.Am i right?cud anybody verify
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

Idempotent methods are one which returns the same result. For example multiply(a,b). The method does not have any side effect. The HTTP GET methods method is supposed to be idempotent whereas POST is not.


Groovy
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Jayson Falkner said:

An Idempotent operation is an operation that if run multiple times has no affect on state -- that is, it is query only not update.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by nila dhan:
The Get method is idempotent whereas the post method is not.Am i right?cud anybody verify


Quite right. Learning, it is good.
Arjunkumar Shastry
Ranch Hand

Joined: Feb 28, 2005
Posts: 986
Yes.
Mathematically,if R is some set and if it holds Associative/distibutive/closure properties and if some element x of R has the property such that x*x = x then element x is said to be idempotent.
For example ,any square identity matrix should be idempotent.
[ September 30, 2005: Message edited by: Arjunkumar Shastry ]

Namma Suvarna Karnataka
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The original design of the GET method was to be idempotent (in the dark, early days of the internet) but this is the intent and should not be taken as fact.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

Originally posted by David O'Meara:
The original design of the GET method was to be idempotent (in the dark, early days of the internet) but this is the intent and should not be taken as fact.


I have seen lot of web applications where GET is used to update data at the server side.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks a lot everybody.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
On page 114 of HFSJ, at the bottom, this is written: "Post is considered idempotent by the HTTP 1.1 specs".

And just before 2 or 3 pages to this, they are writing that, when ever it is post think of update.

So post can't be idempotent (it may be but we should not consider it idempotent).



Thanks.
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
On page 114 of HFSJ, at the bottom, this is written: "Post is considered idempotent by the HTTP 1.1 specs".

And just before 2 or 3 pages to this, they are writing that, when ever it is post think of update.

So post can't be idempotent (it may be but we should not consider it idempotent).


Actually thats a mistake. It is mentioned in the errata http://www.oreilly.com/catalog/headservletsjsp/errata/headservletsjsp.confirmed
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Thanks Satish.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Idempotent???
 
Similar Threads
What is an Idempotent Requests
http head methods
Only POST is not considered idempotent ?
idempotenet or NOT
IDEMPOTENT or not ?