Harikrishna Gorrepati wrote:Hi, What is the meaning of POST has a body ? GET has no body ?
The POST has the ability to carry data as PAYLOAD, whereas the GET doesn't has this type of special capability. Henceforth, since POST ought to carry data with itself, it has body. Hope you are not concerned with the body of the method i.e. the code. In that case its empty as a default for you to override.
It's because if you want to send data to the server you can use some mechanisms, one of them is the URL through http parameters (those with &name=value), and other is the body. The body does the same of the URL while sending data to the server, however, there is some benefits and some limitations,
Using URL you can bookmark it, which allow your users to restore the state of your application through just URL in an RESTful manner.
Using body you don't have any size limit. (There is size limit with URL because most part of browsers limit a maximum of characters in the URL, however, there is no such limitation on the HTTP specification)
Using URL all data is sent to the URL when submiting some data, with body it doesn't. (let's say you want to send some password to the server, you'll not want that it appear on the URL)
The body is also called payload, because it's in bytes how much you've to pay to get that load of data.
About the second answer. No, GET has no body, it just carries the basics HTTP headers / info. It's because in theory how his name explicit, it's just a call to get something, not to send. While with POST you're posting something to the server.
Hope it helps!
Feel free to ask me anything!
www.BlackBeltFactory.com/ui#!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6