Different Actors in Web application
There are different actors which comes into picture of web application.
- End User
- Web Client(Browser Application)
- Server(Web Server / Application Server)
- Actual Page requested on Server
User : It’s the end user who actually raise the request for a page on Server or submit a form.
Web Client : Browsers(IE, Firefox..) are software that knows how to communicate with servers using HTTP protocol and render the page recieved from server in the form of HTML.
Server : Servers are kind of software which handle the user request and search for the content requested by end User and return the appropriate result(Requested Page or Error Code). Server can be of two type web server and App Server. It’s web server which directly handles the user request and pass it to app server to process.
What is HTML
HTML(Hyper text markup Language) is a language used by servers to send the response to Browser’s so that they(Browsers) can render the page properly on user side.
What is HTTP Protocol
HTTP(Hyper Text Transfer Protocol) is protocol used by client(Browser) and server(Web Server) to communicate. HTTP has web specific featured that runs on TCP/IP protocol. Structure of HTTP conversation can be divided in two types, HTTP Request or HTTP Response.
Note*: HTML can be the part of HTTP protocol response.
When ever end User clicks any link or submit any form browser send HTTP Request to Server so that server can process it and provide the HTTP Response.
HTTP Request’s are of different kind. HTTP has several methods which inform the server about the kind of Request is being made by browser.
Methods in HTTP Protocol
GET method is the default method which will be used by Browser(If not specified explicitly). GET method is used by browser to ask(Not submitting any data) for some kind of resources on server(HTML, Image, PDF etc..).
POST method is used by browser to send some information to server for processing. Eg. Form Submission..
HTTP Request Example
User-Agent =Mozilla/5.0 (Windows NT 6.0; rv:15.0) Gecko/20100101 Firefox/15.0.1
Accept-Encoding =gzip, deflate
Cookie =****Deleted Date *********
If-None-Match =****Deleted Date *********
Difference between GET and POST method
GET method used for asking some data from server. While POST is used for submission some data to server.
GET is idempotent while POST is not idempotent.
GET do not have any BODY part while POST has.
GET can submit some data but that will be the part of Header and there is limitation on data submitted via GET method while Post can submit data in body part and there is no restriction on data that can be submitted in POST request.
This is what server send to user client(Browser) when user ask for something from Server(GET / POST Request). HTTP Response contains Header and a Body part.
HTTP Response Header Contains below information along with others
- Protocol Version(Used by web server)
- HTTP Status Code(Successful/Fail/Not Found….)
- Content Type (MIME Type)
- Content Length
- Server details
Content Type(content-type) in header part of HTTP response is also known as MIME type. This information is used to tell the browser the kind of data server is sending, weather it is Image or Text or PDF or anything else. According to this information Browser will know how to handle the data.
HTTP Response, Body part contains the HTML or other content that needs to be rendered by Browser on client side.
HTTP Response Example
Status =OK - 200
Date =Sun, 07 Oct 2012 18:00:32 GMT
Expires =Sun, 07 Oct 2012 19:00:33 GMT
Cache-Control =max-age=3600, public, must-revalidate, proxy-revalidate
X-Powered-By =W3 Total Cache/0.9.2.4
Set-Cookie =PHPSESSID=3ccad49ae7e632de2f908b8ba36e70a5; path=/
Last-Modified =Sun, 07 Oct 2012 18:00:33 GMT
Content-Type =text/html; charset=UTF-8
X-Cache =*****************Deleted Data***************
X-Cache-Lookup =*****************Deleted Data***************
Via =*****************Deleted Data***************