File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes What is the meaning of POST has a body ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "What is the meaning of POST has a body ?" Watch "What is the meaning of POST has a body ?" New topic

What is the meaning of POST has a body ?

Harikrishna Gorrepati
Ranch Hand

Joined: Sep 23, 2010
Posts: 423
Hi, What is the meaning of POST has a body ? GET has no body ?

OCPJP 6.0-81% | Preparing for OCWCD | |
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

Basic HTTP. POST has a body in which data can be posted. GET does not.

[Asking smart questions] [About Bear] [Books by Bear]
Gaurav Sagar
Ranch Hand

Joined: Sep 08, 2010
Posts: 97

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.


SCJP 1.6(91%), SCWCD 1.5(100%), SCBCD in progress
Jayr Motta
Ranch Hand

Joined: Jul 30, 2010
Posts: 110


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!!/ref=jmotta, SCJP 6, OCWCD JEE5, OCE EJB JEE6
I agree. Here's the link:
subject: What is the meaning of POST has a body ?
It's not a secret anymore!