permaculture playing cards*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes idempotent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "idempotent" Watch "idempotent" New topic
Author

idempotent

Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Regarding idempotent my findings in API and specs.

doGet
The GET method should be safe,The GET method should also be idempotent

doHead
Make sure that the doHead method you write is both safe and idempotent

So these two methods are idempotent



doPost
doPut
doDelete

This method does not need to be either safe or idempotent
So these three methods are not idempotent


doOptions
doTrace

these mehtods doesn't give any thing about idempotent.
Are these 2 not idempotent


Please do provide your view also.

[ August 20, 2008: Message edited by: Chintu sirivennela ]
[ August 20, 2008: Message edited by: Chintu sirivennela ]

SCJP 5 |SCWCD 5| Started thinking about Web Services ?
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Idempotent means side effect if we call the same method two times.
now try to make a decision with the meaning of idempotent and working of method.

for example:
doDelete :- one you have deleted the data based upon a particular condition, no matter how many times you call the method the data is already deleted.
so there should not be any side effect. hence this method is Idempotent.

But the exception to this problem is that if after deletion fresh data is generated then in the second time fresh data will be deleted. so idem potency of method depend upon circumstances.


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Balaji Natarajan
Greenhorn

Joined: Nov 24, 2007
Posts: 29
1. doOptions will give you the HTTP methods supported by the server.
How many times you call this, you will get same response. There is no side effect in calling this many times.

2. doTrace will give a copy of what server has received at the other end.
Think here too, idempotency is not be worried as the response depends on your request.

Hence, well, these two methods can be called as 'Idempotent'


Best Regards,<br />Balaji Natarajan<br /> <br />SCJP 1.5 100%<br />SCWCD 1.5 92%<br />SCBCD (In Progress)
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Thanks Balaji and Sunny

So finally I can say

idempotent methods are :
1.doGet
2.doHead
3.doOptions
4.doTrace

Non idempotent methods are :
1.doPost
2.doPut
3.doDelete

Am I correct
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

only doPost() in non-idempotent
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Hi seetharaman,

I also read many places only post is non-idempotent but see my post that is from specs and API after reading that come to a conclusion.

I am also plaaning to come to a conclusion besed on the opinions of ranchers.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Sunny Jain:
doDelete :- one you have deleted the data based upon a particular condition, no matter how many times you call the method the data is already deleted.
so there should not be any side effect. hence this method is Idempotent.


hi cinthu , how about this ?
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Actually whether the method is idempotent or not, it depends upon the implementation. If you don't override the doGet method it can be non-idempotent. for example : if you delete the first row of table.

when the question comes to you about idempotent you should think the ideal implementation of the method as per the name of method indicate.
in such concern put and delete are idempotent.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: idempotent
 
Similar Threads
Scripting Invalid
Which of the following statements are correct regarding tag libraries?
Marcus Green exam: Dueling auth-constraint elements
isELIgnored attribute
Simple and Classic tags understanding