J2EE - Interview Questions and Answers on HTTP

Q1.  What is URL?

Ans. URL is Uniform Resource Locator which is representation of HTTP address.

Q2.  What is HTTP ?

Ans. HTTP or Hypertext Transfer Protocol is internet protocol for transmission of hypertext ( text with meta data ) over internet.

Q3.  what is content negotiation?

Ans. Suppose we want to visit a site for any information, information can be represented in different languages like English,German or may be other and their format for presentation can also differ from HTML to PDF or may be Plain text. In this case when an client makes an HTTP request to a server, client can also specify the media types here. Client can specify what it can accept back from host and on the basis of availability the host will return to the client. This is called content negotiation because client and server negotiated on the language and format of the content to be shared.

Q4.  Why Web services use HTTP as the communication protocol ?

Ans. With the advent of Internet, HTTP is the most preferred way of communication. Most of the clients ( web thin client , web thick clients , mobile apps )  are designed to communicate using http only. Web Services using http makes them accessible from vast variety of client applications. 

Q5.  What doesn Http keep alive header does ?

Ans. Http is connection less by default. header informs hosts to keep the connection alive so that the same connection can be reused for multiple communication.