12 October 2010

2 What is a Servlet Container in Java?

Servlet Container


      A standalone Java program is directly invoked by the end user and starts its execution from the main method. But in case of a servlet, the client makes a http request to the Web-Server in order to execute the servlet. For the servlet to execute it has to be loaded into the memory, receive the client request and respond back to the client. These responsibilities are carried out by a service known as the Servlet container.

Services provided by Servlet Container

Network Service
The Servlet Container along with a web server or application server, provides the necessary network services so that the request and response can be communicated over the network between the client and the server.

Coding/decoding
The container decodes MIME (Multipurpose Internet Mailing Extensions) based requests and then passes on the request object to the servlet. Similarly formats the response generated by the servlet into MIME based responses so that the client browser understands the output generated by the servlet.

LifeCycle Management
It manages the lifecycle of the servlet.

Servlet Container can either be a part of the host web server or installed as an add-on component to a Web Server.
       Servlet Container can also be built into Application Servers. HTTP protocol is supported by all the vendors for requests and response. But along with HTTP they may support other request/response based protocols such as HTTPS (HTTP over SSL).


2 comments:

Feeds Comments
Unknown said...

the information provided is very basic

Knight said...

@SINGH A ...Thanks for adding a comment. What topic are you looking for? Just let me know.
I am a J2EE professional, probably I can help you out.
Thanks
Admin

Please give your valuable comments.