21 Feb 2014

HTTP Request Headers I (Headers only)


Headers:



1.      Accept:-

-          This header specifies the MIME types that the browser or other clients can handle.

-          A servlet that can return a resource in more than one format can examine the Accept header to decide which format to use.

Ex - request.getHeader ("Accept");


2.      Accept- Charest:-

-          This header indicates the character sets the browser can use.

Ex - request.getHeader ("Accept-Charest");

3.      Authorization:- 
 
-          This header is used by clients to identify themselves when accessing password-protected Web pages.

4.      Connection:- 

-          This header indicates whether the client can handle persistent HTTP connections. Persistent connections permit the client or other browser to retrieve multiple files with a single socket Connection.

5.      Cookie:-


-          This header returns cookies to servers that previously sent them to the browser.

Ex- request.getHeader ("Accept-Charest");

6.      Host:-


-          This header indicates the host and port as given in the original URL.

Ex- request.getHeader ("Host");


7.      Referer:-


-       This header indicates the URL of the referring Web page.

Ex- request.getHeader ("Referer");

8.      Accept-Language:-


-          This header specifies the client's preferred languages in case the servlet can produce results in more than one language.

-          The value of the header should be one of the standard language codes such as en, en-us, da, etc.


9.      If-Modified-Since:-

-          This header indicates that the client wants the page only if it has been changed after the specified date.


-          The server sends a 304 (Not Modified) header if no newer result is available.

Ex- request.getHeader ("If-Modified-Since");

10.  If-Unmodified-Since:-

-          This header is the reverse of If-Modified-Since it specifies that the operation should succeed only if the document is older than the specified date.

Ex- request.getHeader ("If-Unmodified-Since");


11.  User-Agent:-


-          This header identifies the browser or other client making the request and can be used to return different content to different types of browsers.

-          However, the User-Agent header is quite useful for distinguishing among different categories of client.

-          For example, Japanese developers might see whether the User-Agent is an Imode cell phone, a Skynet cell phone, or a Web browser.


Ex- request.getHeader ("User-Agent");


12.  Accept-Encoding:-

-          Using an encoding the browser doesn't understand results in incomprehensible pages. 

-          Consequently, it is critical that you explicitly check the Accept-Encoding header before using any type of content encoding. 

-     Values of gzip or compress are the two most common possibilities.

13.  Content-Length:-


-          This header is applicable only to POST requests and gives the size of the POST data in bytes.


Ex- request.GetIntHeader ("Content-Length");

Written by

Hello,Visitor..!

0 comments:

Comments

© 2013-2016 ITTechnocrates. All rights resevered. Developed by Bhavya Mehta