File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IDEMPOTENT or not ?

 
hasan khan
Ranch Hand
Posts: 222
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody tell me from exam point of view that which of the following methods are IDEMPOTENT or not ?

GET : IDEMPOTENT or not
POST : IDEMPOTENT or not
PUT : IDEMPOTENT or not
HEAD : IDEMPOTENT or not
DELETE : IDEMPOTENT or not
TRACE : IDEMPOTENT or not
OPTIONS : IDEMPOTENT or not
CONNECT : IDEMPOTENT or not
 
Billy Tsai
Ranch Hand
Posts: 1304
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
idempotent means that the same resulting state change is
made regardless of whether a method is execute 1 time or 100 times.
An idempotent method is one that can be repeated with no negative side effects.
 
pallavi utukuri
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The methods GET, HEAD, PUT, DELETE, OPTIONS and TRACE SHOULD NOT have side effects, and so are inherently idempotent.

POST is not idempotent
 
Gaurav Sahni
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello CattlePeople,

i have also been pondering over this "Idempotent" stuff from some time. Read some where in previous posts that according to JSP specs, Put and Delete also may have some side effects on repetative execution. So, they are non-idempotent.

It is confusing.Request somebody to clear the mud....

Regards,
Gaurav
 
pallavi utukuri
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i came across this....

Idempotent Methods:

Methods may also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property.
 
Pabak Nanda
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I also found the fact from the servlet specs that doPut and doDelete methods are not idempotent. Please refer page 235 ( for doPut ) and page 230 ( for doDelete).

Hope this helps. If still there is any doubt we can discuss.

Thanks,
Pabak
[ November 07, 2004: Message edited by: Pabak Nanda ]
 
Gaurav Sahni
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, so let me put it all-together, answering the original question...

GET : IDEMPOTENT
POST : NON-IDEMPOTENT
PUT : NON-IDEMPOTENT
HEAD : IDEMPOTENT
DELETE : NON-IDEMPOTENT
TRACE : IDEMPOTENT
OPTIONS : IDEMPOTENT
CONNECT : IDEMPOTENT

Regards,
Gaurav.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic