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
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
相关文章推荐
- Caches 《ARM System Developer's Guide》chapter-12
- JS require 深入剖析
- UINavigationController 弹出新的UIViewController时,setNavigationBarHidden失效的问题
- UITableViewCell点击时背景颜色
- 并发队列ConcurrentLinkedQueue和阻塞队列LinkedBlockingQueue用法
- Codeforces 609F Frogs and mosquitoes 二分+简单离散化线段树+Multimap
- 如何在SpriteBuilder中设置对象的通用属性
- 如何在SpriteBuilder中设置对象的通用属性
- 如何在SpriteBuilder中设置对象的通用属性
- ios9 xcode7 UIAlertController的常用用法
- UIView常见属性方法
- Win10 Redstone预览版本Build 11099/11102升级报错的解决方法
- win10 build 11102突变Build 14251到底怎么回事?
- ERROR: Packet for query is too large (2034> 1024)
- leetcode63-Unique Paths II
- SPOJ QTREE2 Query on a tree II(LCA)
- JDBC连接池的testQueryvalidationQuery设置
- EasyUi输入框验证扩展!!!大全!!!!
- easyUI 加载层
- 【树】Unique Binary Search Trees II