Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubi in Head First Servlet n JSP book page 114

 
Manish Singh
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTTP 1.1 spec declares GET,HEAD, and PUT as indempotent even though you can write a non indempotent doGet() method yourself(but shouldn't).
POST is considerd indempotent by the HTTP 1.1 spec.

what does it mean ? isn't it saying that all above mentioned HTTP methods are indempoent?
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

As mentioned in the HFSJ book, an idempotent method is the one without any negative consequences on the server side.

From the statement above, GET only gets something from the server back to you.

But with post, you may have to save the data of a web-form on the database, so this will cause side effects (talking to your MySQL server as an example).

So POST is not idempotent.

There's a great statement in the HFSJ book which says : " Being idempotent is good. It means you can do the same thing over and over again, with no unwanted side effects! "

Think about it for a while, with GET you can get a specific resource thousands of times without any editions on the server side.

For sure you can make a GET to act as a not idempotent, but, following the rules and the spec will make you feel better ...

Best regards ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic