首页 > 其他 > 详细

The process of container handles the servlet request

时间:2016-01-28 10:44:31      阅读:291      评论:0      收藏:0      [点我收藏+]

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

 

The process of container handles the servlet request

原文:http://www.cnblogs.com/zhilin-yang/p/5165385.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!