Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get, post, head and other http methods  RSS feed

 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I was reading an article in which it stated that http methods such as get is idempotent (no side affects on server) whereas POST does have side affects on the server.
Now this confused me a little. I know that when we mark a form method as "GET" instead of a "POST" say in our JSP page - our receiving servlet could still make changes and have side affects on the server.
Am I taking this into the correct syntax ??The author also talks about PUT,DELETE and HEAD . I never used these before could anyone tell me when are they used I just used get/post??
 
Tim Moores
Saloon Keeper
Posts: 3512
77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GET should be idempotent, meaning your servlet's doGet method must not change state on the server; otherwise it's in violation of the HTTP specification. You're right that it's perfectly possible to implement doGet in a way that it's not idempotent - but that's asking for trouble.

GET and POST are indeed the only methods supported by HTML forms. The other methods are used in other contexts, such as RESTful web services, WebDAV and some others. You can play around with those using JavaScript's XMLHttpRequest object - it allows you to use all HTTP methods, or using a Java library such as Apache Commons HttpClient.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that clears a lot.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!