Web Application Architecture: Container

Web Application Architecture: Container
-------------------------------------------------

A Servlet doesn’t have a main method, but it still can be used, we run it, and use the Request and Response objects. Who will create the Servlet methods and who will create the Request and Response objects? The answer is the Container.
The container is an application on Java which controls the Servlet. His roles are:
-Communication Support: Our Servlet will talk with the web without creating a socket, without setting a port, all of that are done by the container.
-Life cycle: Servlet are supposed to be java class but we never create their object and never call their methods.
-Multithreading support: Each time the container receive a request, it will start a new thread and complete it after the running the HTTP method for that client request.
-Declarative security: The container itself will determine if the client is a sure and secure one.
-JSP Support: The container will change the JSP code into real Java.


How a container handles a request?
1.Get the request from the user by te URL
2.Create the HttpServletResponse and HttpServletRequest objects
3.Find the correct Servlet based on the URL
4.Call the method of service (doGet() or doPost())
5.Generate the dynamic page
6. Send the response object in the Http Response and delete the Request and Response objects.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值