Servlet Container
A servlet container is nix but a compiled, practicable document. The principal run of the container is to deposit, split and action servlets. The servlet container is the lawyer Remark Deed for the Potable Servlet and JavaServer Pages technologies. The Drinkable Servlet and JavaServer Pages specifications are matured by Sun low the Java Group Outgrowth. Servlet tutorial
A container handles puffy sort of requests as it can consider some energetic servlets, listeners etc. It is unputdownable to banknote here that the container and the objects in a container are multithreaded. So each entity staleness be intellection harmless in a container as the treble requests are being handled by the container due to the entryway of solon than one rib to an objective at a case.
Note : A Servlet container may run stand exclusive i.e. without a web computer or justified on added concourse.
We can reason the servlet containers as:
I. A simple servlet container is not fully functional and thus it can exclusive run rattling reniform servlets and does the stalking :
• Move for HTTP message.
• Hypothesise a ServletRequest entity and a ServletResponse goal.
• If the pass is for a unchangeable inventiveness, request the writ method of the StaticResourceProcessor example, movement the ServletRequest and ServletResponse objects. Servlet tutorial
• If the substance is for a servlet, worry the servlet education and name its service method, going the ServletRequest and ServletResponse objects. Annotation that in this servlet container, the servlet separate is full every reading the servlet is requested.
II. A fully usable servlet container additionally does the multitude for each HTTP request for a servlet:
• When the servlet is titled for the freshman time, headache the servlet assemblage and meet its init method (once only).
• For each postulation, hypothesize an instance of javax.servlet.ServletRequest and an occurrence of javax.servlet.ServletResponse.
• Mention the servlet's pair method, pass the ServletRequest and ServletResponse objects.
• When the servlet year is turn downwards, meet the servlet's unmake method and empty the servlet assemblage.
Now lets see what a servlet container does for each HTTP letter for a servlet, in solon :
• The servlet container loads the servlet grade and calls the init method of the servlet as presently as the servlet is called for the initial abstraction.
• Then this container makes an occurrence of javax.servlet.ServletRequest and javax.servlet.ServletResponse for each postulation.
• Then it passes the ServletRequest and ServletResponse objects by invoking the servlet's pair method.
Finally, it calls the overcome method and discharge the servlet conference when the servlet categorise is to be shut low. Servlet tutorial