jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes doGet(). , Java Servlet Spec Q? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doGet(). , Java Servlet Spec Q?" Watch "doGet(). , Java Servlet Spec Q?" New topic

doGet(). , Java Servlet Spec Q?

rahul dighe
Ranch Hand

Joined: Apr 17, 2001
Posts: 44
I was wondering if someone can explain me what do the following lines mean in plain english.
The GET method should be safe, that is, without any side effects for which
users are held responsible. For example, most form queries have no side
effects. If a client request is intended to change stored data, the request
should use some other HTTP method.
The GET method should also be idempotent, meaning that it can be safely
repeated. Sometimes making a method safe also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product
online or modifying data is neither safe nor idempotent.side effects for which users are held responsible

<BR>Rahul Dighe
Sam Dalton
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
This means (if I understand correctly) that an Http GET request should retireve data only, that is make no modifications to persistent data. This makes sense if you look at the name, GET (to get data from). In order to persistent data, an HTTP POST request should be sent (to post data to).
If this is adopted, then idempotency would be achieved, that is the method would perfrom the same function (return the same data) no matter how many times it is called.
Hope this explains things at least a little more clearly.

<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: doGet(). , Java Servlet Spec Q?
It's not a secret anymore!