Wednesday, May 13, 2009

Servlet Container

A servlet is managed by a servlet container also referred to as Servlet Engine. The servlet container is a compiled, executable program.

The container is the intermediary between the application (web server) and the servlets in the container.The container loads, initializes, and executes the servlets. When a request arrives, the container maps the request to a servlet, translates the request and then passes the request to the servlet. The servlet processes the request and produces a response.The container translates the response into the network format, then sends the response back to the Web server.

The servlet container together with the web server (or application server) provides the HTTP interface to the world. It is also possible for a servlet container to run stand alone (without web server) or to even run on another host than the web server. When a request is received by the servlet container, it decides what servlet to call in accordance with a configuration file. The servlet Container calls the servlet's service() method and passes an instance of ServletRequest and ServletResponse. Depending on the request's method (mostly GET and POST), service calls doGet() or doPost().

These passed instances can be used by the servlet to find out who the remote user is, if and what HTTP POST parameters have been set and other characteristics. The servlet container is responsible for loading and instantiating the servlets and then calling init().

The container is designed to perform well while serving large numbers of requests. A container can hold any number of active servlets, filters, and listeners. Both the container and the objects in the container are multithreaded. The container creates and manages threads as necessary to handle incoming requests. The container handles multiple requests concurrently, and more than one thread may enter an object at a time. Therefore, each object within a container must be threadsafe.

A servlet container can manage any number of distinct applications. An application consists of any number of servlets, filters, listeners, and static Web pages. A set of components working together is a Web applicatio

1 comments:

http://www.elantechnologies.com/,  December 1, 2009 at 10:44 PM  

Hi, I have read some Articles for Java really interested Article. I am java/J2EE Developer. i want to knaw Any Article on Blackberry Application Development.

Thanks.
Elan Emerging Technologies

Blog Widget by LinkWithin

JS-Kit Comments

  © Blogger template Newspaper III by Ourblogtemplates.com 2008

Back to TOP