You are on page 1of 1

Explain the Request and Response Life Cycle with the example.

Static
file
search

request

Client Web Server

response Servlet/
JSP/PHP/
CGI etc

Web container
Client sends a request to the web server.

Web server will check whether the request is for static or dynamic information based
on URL.

If it is for static information then web server will search for that static file. If is
available then server will provide that static file as response. If it is not available then
server will provide 404 status code i.e. requested resource is not available.

If the request is for dynamic information then web server will forward the request to
other application that application may be Servlet, JSP,CGI, ASP,PHP etc.

That application will analyse request, process request and generates required
dynamic response. Also forwards that response to web server and web server
forward that response to the client.

Example:

If a user entered http://facebook.com into their web browser, the web browser would
send a request to the server looking for the facebook resource.

You might also like