aspose file tools*
The moose likes Servlets and the fly likes which method is idempotent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "which method is idempotent?" Watch "which method is idempotent?" New topic
Author

which method is idempotent?

ssiva kumar
Greenhorn

Joined: May 29, 2006
Posts: 9
hi all,
which methode is called idempotent. why ?

Expalin?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

Sounds like a homework question to me. What's your answer?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

HTTP Get is supposed to be idempotent.


Groovy
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
It doesn't look like idempotent for me. I'd rather to have init and destroy as idempotent.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Michael Valentino
Ranch Hand

Joined: Nov 01, 2005
Posts: 96
When talking about idempotent methods, we're 99% of the time referring to the HTTP methods; of which the GET method is supposed to be idempotent by nature. That's not to say that you can't do something wacky in your doGet() method to make it non-idempotent....


SCJP 1.4, SCWCD J2EE 1.4, SCJD J2SE 1.5, SCBCD J2EE 1.3, SCDJWS (In Progress)
Harpreet Hira
Ranch Hand

Joined: Sep 27, 2001
Posts: 72
Idempotent - A function, is idempotent if, whenever it is applied twice to any element, it gives the same result as if it were applied once.

The idempotent method can be safely repeated.

POST method is considered non-idempotent. The reason is that the POST is supposed to post data to the server, which means it may be used to save the data in persistent location OR to do some action based on that posted data.

Similarly, GET is NOT supposed to update data, but to get data, although we can(and we do) implement GET to update data, by posting data using query string. So, GET may sometimes behave non-idempotently.
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Right, it's a problem of many applications, because a browser considers get as idempotent and doesn't do repeat calls just uses caching result.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: which method is idempotent?