SCJP, SCWCD, SCBCD
Thanks<br />Lakshmi<br />SCJP 1.4 - 90%<br />SCWCD 5 - 89%
It is how we implement. GET can also sometimes idempotent.
lets say we do like this
doGet(){
doPost()
}
then doGet cannot be idempotent right?
in general or usualy manner HTP DOC and GET are all idempotent
HTP stands for HEAD, TRACE, PUT
DOC stands for DELETE, OPTIONS, CONNECT
SCJP, SCWCD, SCBCD
SCJP, SCWCD, SCBCD
Deepak Jain wrote:HSFS Second Edition.
Q 4: Page 145
Which Http methods are considered NOT Idempotent.
A GET
B POST
C HEAD
D PUT
Answer POST. However PUT is also Not Idempotent.
From doPut() API Doc
This method does not need to be either safe or idempotent. Operations that doPut performs can have side effects for which the user can be
held accountable. When using this method, it may be useful to save a copy of the affected URL in temporary storage.
Hence Put is also not idempotent.
So the answer to this question must be POST and PUT.
Further
GET, HEAD Idempotent and safe.
PUT, DELETE, POST Non Idempotent and not safe
Trace, Options and Connect do not fall in any category as they are out of context for this question.
Is my explaination correct?
Gert-Jan den Besten wrote:IMHO the question is how HTTP1.1 defines the HTTP methods, not how the Java API describes the Servlets' doXXX() methods.
Reidar Gjerstad wrote:
Gert-Jan den Besten wrote:IMHO the question is how HTTP1.1 defines the HTTP methods, not how the Java API describes the Servlets' doXXX() methods.
It appears to me there is an inconsistency between how HTTP 1.1 defines PUT and how the API doc defines it. According to the javadoc (see above) the PUT can have side effects, i. e. is Not Idempotent.
SCJP 5; SCJD; SCWCD 5.
Gert-Jan den Besten wrote:
Reidar Gjerstad wrote:
Gert-Jan den Besten wrote:IMHO the question is how HTTP1.1 defines the HTTP methods, not how the Java API describes the Servlets' doXXX() methods.
It appears to me there is an inconsistency between how HTTP 1.1 defines PUT and how the API doc defines it. According to the javadoc (see above) the PUT can have side effects, i. e. is Not Idempotent.
There is no inconsistency. Let's take a look at HFSJ page 116:
GET is idempotent according to the HTTP spec. But there’s nothing to stop you from implementing a non-idempotent doGet() method in your servlet. The client’s GET request is supposed to be idempotent, even if what YOU do with the data causes side-effects. Always keep in mind the difference between the HTTP GET method and your servlet’s doGet() method.
I think that explains it all.....
Reidar Gjerstad wrote:PUT does have side effect if the basic idea is to upload something to the server.
SCJP 5; SCJD; SCWCD 5.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |