Monday, August 29, 2016

HTTP Communication between Client and Server

Step 1: On the client machine, user who wants a web-resource(eg: html document) from a web server types the URL of the resource in a Browser window and then clicks GO.

Step 2: Browser - a s/w program(Eg C or C++) running on the client machine - takes URL as the input and converts it into HTTP message(also called HTTP request) since Http Clients(Eg Browser) and Http Servers(Eg Apache Web server) use HTTP protocol to communicate. All modern browsers are pre-built with the functionalities of encoding and decoding Http(Application layer protocols or OSI layers 5,6,7) message to/from servers. Servers too have the similar capablities.


   To be more specific, Browser implements** Client Side of the HTTP protocol and Web Server implements Server side of the HTTP protocol.

   The converted HTTP message is then handed over to machine's Operating System's Protocol infrastructure(OSI layers 1,2,3,4) -  Transfer Control Protocol(TCP part of Transport Layer), Internet Protocol(IP part of Internet layer) and Network Protocol( Part of Link Layer). HTTP Message when passed through these three layers will be ultimately become electric/electronic signals which can be transmitted through wired or wireless Internet to the destination.


Step 3: The HTTP message(in the form of electric/electronic/electro magnatic/ light signal) then arrives at the destination machine(Http server in this case). Exact reverse process follows here and converted back to HTTP message. This HTTP message is then be read by Http server(a Software program running on the server machine having the capabilities to read and understand HTTP messages) translates it for later processing by any Java/.NET middle-ware program (which also is running on the server machine). Once the processing is done, a Http Response is created and sent back to client in the exact same fashion(Step 1 through Step 3...shown below)





**What is meant by HTTP implementation by Browser or Web Server?
The explanation could be as simple and plain as a Student asking his or her Teacher a question.

Analogy:

Student who wants to ask his/her English teacher a question says..

What is the tallest structure in the world? ----> [A Message in ENGLISH]


The sentence is constructed based on the Grammar guidelines specified by English language.


Similarly, a browser which wants a html document from a Webserver on a remote machine requests in the following way...


GET /hello.htm HTTP/1.1

User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Host: www.google.com
Accept-Language: en-us

The above is [A Message in HTTP]


The message is constructed based on the guidelines specified by W3Consortium on HTTP protocol.


A protocol can be identical to a langugage.

No comments:

How J2EE components work together in any Container - Spring or Application Server

In a Spring+Jersey+Hibernate RESTful webapplication, we can spot various J2EE components - JTA, JPA, Java Bean Validation, JSON-B API for B...