• HTTP (Hypertext Transfer Protocol) is perhaps the most popular
application protocol used in the Internet (or The WEB).
• HTTP is a stateless protocol. In other words, the current request does
not know what has been done in the previous requests.
• Whenever you issue URL from your browser to get a web resource using
HTTP, the browser turns the URL into a request message and sends it to
the HTTP server. The HTTP server interprets the request message, and
returns you an appropriate response message, which is either the
resource you requested or an error message.
Important header information
Accept This header specifies the MIME types that the browser or other
clients can handle. Values of image/png or image/jpeg are the
two most common possibilities.
Authorization This header is used by clients to identify themselves when
accessing password-protected Web pages.
Content-Length This header is applicable only to POST requests and gives the
size of the POST data in bytes.
Methods to read HTTP Header:
There are following methods which can be used to read HTTP header in your servlet
program. These methods are available with HttpServletRequest object.
Returns an enumeration of all the header names this request contains
String getHeader(String name)
Returns the value of the specified request header as a String.