The HTTP client (such as a browser) must specify the request type when sending a request to the server (typically GET or POST). If necessary, the client can also choose to send other request heads. Most requested heads are not required, except for Content-Length. Content-length must appear for POST requests.
Here are some of the most common request heads.
Accept: The browser acceptable MIME type.
Accept-charset: The browser acceptable character set.
Accept-encoding: Browser can decode data encoding, such as Gzip. Servlets are able to return to Gzip's browsers to returns the Gzip encoded HTML page. This can reduce download time by 5 to 10 times in many cases.
Accept-language: The language type of the browser wants to use when the server provides more than one language version.
Authorization: Authorized information, usually appears in a response to the WWW-Authenticate header sent to the server.
Connection: Indicates if a persistent connection is required. If the servlet sees the value here "Keep-alive" or see the request is HTTP 1.1 (HTTP 1.1 default persistent connection), it can take advantage of the persistent connection, when the page contains multiple elements (for example, Applet, image), significantly reduce the time you need. To achieve this, servlet needs to send a Content-Length header in your response. The simplest implementation method is: first writing the content into ByteArrayoutputStream, and then calculate its size before formal writing.
Content-length: Indicates the length of the text of the request message.
Cookie: This is one of the most important request headers, see the discussion in the chapter of "Cookie Processing" later.
From: Request the sender's Email address, use some special web clients, the browser will not use it.
Host: The host and port in the initial URL.
If-modified-since: Only returns it only when the requested content is modified after the specified date, otherwise returns the 304 "Not Modified" response.
Pragma: Specifies the "no-cache" value indicates that the server must return a refresh document, even if it is a proxy server and already has a local copy of the page.
Referr: Contains a URL that uses the user from the page represented by the URL to access the currently requested page.
User-agent: Browser type, if the content returned by servlet is very useful to the browser type.
UA-PIXELS, UA-Color, UA-OS, UA-CPU: Non-standard request headers sent by some versions of IE, represent screen size, color depth, operating system, and CPU type.
For complete, detailed descriptions of HTTP headers, see http specifications http://www.w3.org/protocols/.