When a Web server receives a client request for static web pages (usually files with an extension .htm or .html), it looks for the requested page, and simply responds to the client with the contents. However, when dynamic content is requested, the behavior of the server needs to be different: In this case, a program has to be run on the server machine that interprets the parameters of the request and generates the content accordingly.
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
Brief introductions of servlets
1. Brief introductions of servlets
Whena Web serverreceivesaclientrequestforstaticwebpages(usuallyfileswithanextension.htm or
.html),itlooks for the requested page, and simply responds to the client with the contents. However,
when dynamic content is requested, the behavior of the server needs to be different: In this case, a
program has to be run on the server machine that interprets the parameters of the request and
generates the content accordingly.
To enable the servertodistinguishbetweenregularrequests for static pages and requests for dynamic
content,the serverneedstobe made aware of whichrequestsshould map to a program. This is usually
done through a server plug-in. This plug-in is a small interface that tells the server which requests are
dynamic (e.g. all pages that end with .cgi or .jsp), and what program to forward these requests to. A
popularwayof generating dynamic content in the past was the Common Gateway Interface (CGI). The
CGI environment instantiates a new child process on the server to handle each request i.e. runs a
program that generates the output dynamically.
This method,however,isvery resource intensive.Creatingathe new runtime environment, initializing
it and destroying it after use are overhead tasks that can weigh heavily when a Web server receives
thousands of requests per day.
A large number of simultaneous requests could even cause the server to crash due to memory
restrictions.Servletsoffer a much lighter weight approach to handling many client requests. Although
the servlet interface definition is based on CGI, it processes requests differently. A single program
running on the server, a so-called Servlet Engine or Servlet Container handles all requests. Instead of
creating a new process for each request, the Servlet Engine uses Java’s multithreading capabilities to
generate the dynamic page within the Servlet Engine’s main process.
Kepranisan webapplicationdevelopmentcompanyprovidingwebapplicationdevelopment services in
webapplicationdevelopment Bangalore expertise in web application development India expertise in
web application development solutions.