Friday, July 20, 2012

What is the difference between doGet() and doPost() methods ?

The difference has given below......


In doGet Method the parameters are appended to the URL and sent along with header information
In doPost parameters are sent in separate line in the body
Maximum size of data that can be sent using doget is 240 bytes
There is no maximum size for data
Parameters are not encrypted
Parameters are encrypted
DoGet method generally is used to query or to get some information from the server
DoPost is slower compared to doGet since doPost does not write the content length
DoGet should be idempotent. i.e. doget should be able to be repeated safely many times
This method does not need to be idempotent. Operations requested through POST can have side effects for which the user can be held accountable for example updating stored data or buying items online.
DoGet should be safe without any side effects for which user is held responsible.
This method does not need to be either safe.


Post a Comment