• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which method is idempotent?

 
ssiva kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
which methode is called idempotent. why ?

Expalin?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a homework question to me. What's your answer?
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP Get is supposed to be idempotent.
 
dema rogatkin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't look like idempotent for me. I'd rather to have init and destroy as idempotent.
 
Michael Valentino
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
Harpreet Hira
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic