(for HTTP 1.1)
Request Headers
are sent by the browser immediately following the initial GET or
POST line. These headers can direct the Servlet how
to react.
|
||||||||||||||||||
How to get Headers:
|
||||||||||||||||||
Header | Meaning | |||||||||||||||||
Accept | Specifies MIME types that the browser can handle (e.g. image/jpg). Servlet can look at this to decide what kind of information it can return in its response. | |||||||||||||||||
Accept-Charset | This tells the Servlet what the character set that can be accepted by the client's browser | |||||||||||||||||
Accept-Encoding | Indicates the encoding types the client can handle. If the
Servlet decides to return data using an encoding type, it must send
an Content-Encoding response header. Note: this is different
than the Content-Type response header...which indicates the kind
of data in the document. The Content-Encoding type is the
encoding applied to the content (of type Content-Type) after the
content is created. On the client browser, the recieved data
is first decoded before it uses the Content-Type to know how to
view the decoded data.
Typically used for compressing data. |
|||||||||||||||||
Accept-Language | Specifies client's preferred languages. See RFC 1766 for name of languuages (e.g. en-us = U.S. english, en = British english, etc). | |||||||||||||||||
Authorization | Used by clients to identify themselves when accessing password-protected Web-pages | |||||||||||||||||
Cache-Control | Client uses to specify how pages should be cached by proxy servers. | |||||||||||||||||
Connection | Client uses to indicate if can handle persistent HTTP connections.
Such a connection allows client browser to retrieve multiple files
(images, html, etc.) with a single socket connection, saving the
overhead of negotiating independent connections for each. values:
|
|||||||||||||||||
Content-Length | Gives the size of a POST method request in bytes. | |||||||||||||||||
Content-Type | Usually used in a HTTP response sent from the Servlet. Can be given by client to Servlet when the client attaches a document as POST data. | |||||||||||||||||
Cookie | Client uses this to return cookies to the server. | |||||||||||||||||
From | Can be used to send as a value the email address of the requestor. Not sent by browsers, but, other applications sending HTTP requests may use this. | |||||||||||||||||
Host | Client sends the host and port as given in the URL.
HTTP 1.1: Browsers are required to send this information. |
|||||||||||||||||
If-Modified-Since | Client sends to indicate they want the requested page (in our case generated by the Servlet), ONLY if it has been changed since the date specified (or in the case of Servlets, if the data used to construct the web-page is newer than this date) | |||||||||||||||||
If-Unmodified-Since | Opposite of If-Modified-Since | |||||||||||||||||
Referer | Indicates the URL of referring web-page. | |||||||||||||||||
User-Agent | Identifies client browser (or application) that made the request.
Can use this when want to know what browser or version of it the client has. Be careful on how to parse results. |
|||||||||||||||||
SEE HTTP specs for other HTTP Request headers. |