The process of container handles the servlet request

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The process of container handles the servlet request相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

The Announcement of the SCS Mesoscale Processes Workshop

Parsing the process of Bean Creation by AnnotationConfigWebApplicationContext

Performs the analysis process on a text and return the tokens breakdown of the text

C++: How is the process of function calling in C++

Inversion of Control Containers and the Dependency Injection pattern (Martin Fowler)

Correct the classpath of your application so that it contains compatible versions of the classes com