您的位置:首页 > 产品设计 > UI/UE

The process of container handles the servlet request

2016-01-28 10:26 621 查看
1. User clicks a link that has a URL of Servlet.



Client Browse Servlet URL

2. Container (Apache Tomcat is one of the example) sees that the request is for servlet , so create two objects :
HttpServletRequest
HttpServletResponse



HttpServletRequest and HttpServletResponse

3. Container finds correct servlet on the basis of URL passed with the helpdeployment descriptor (web.xml) file. Creates / Allocate thread for that request and pass request and response object to servle thread.



Create Thread for Servlet

4. Container calls the servlets service() method, on the type of request, service calls doGet() or doPost() methods.



Service method of servlet

5. Lets assume that service calls the doPost() method. doPost() methodgenerates dynamic page and add the page in response object.



Servlet - doPost - response object

6. Thread completes, container converts the response object into HttpResponse object and destroys the response and request object.



destroy response and request object
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: