码迷,mamicode.com
首页 > 其他好文 > 详细

The process of container handles the servlet request

时间:2016-01-28 10:46:21      阅读:128      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!