Friday, September 16, 2005

Explain the difference between Web Server and Web Container. What is the purpose of a Container.


Container is a java application in which your web components such Servlets and JSP’s are deployed. Its purpose is to provide


  • Communication Support
  • Lifecycle Support
  • Multi-Threading Support
  • Declarative Support
  • JSP Support


Look at page 41 in HFSJ book for brief explanation.

When you think of a web-server, you need to think about HTTP. A web-server talks HTTP. You can think of the web server as receiving the HTTP request from the client (browser) and if the request is asking for some dynamic content then the web server passes the request to the helper application thats part of the web server which is nothing but the container.

Some of the main jobs of the container would be to create and initialize servlets, manage their life cycle, find out which resource should serve a client request, allocate a thread for each incoming request and manage other web components like JSP's , filters (their life-cycle) etc.

The container then returns the response from the resource to the web-server. The web-server would format to actual HTTP response (header and body) and send it to the client.

0 Comments:

Post a Comment

<< Home