3. HttpConnector (one) & HttpProcessor (many)
HttpConnector implements Runnable, run in its own thread. when running/starting, new create a serverSocket and wait for http request.
For each request, it would create a HttpProcessor and invoke processor.process(socket).
HttpProcessor for each passed in socket, create a HttpRequest & HttpResponse. Parse first line & headers and fullfill HttpRequest object. and last process.
4. Container.invoke(Request request, Response response)
Use URLClassLoader to load servlet class (new instance), then call servlet.service(HttpServletRequest, HttpServletResponse)
5. BootStrap process
init a HttpConnector and then call connector.setContainer(container instance)
6. 4 type containers
Engine (whole catalina servlet engine)
--> Host (virtual host of one or more context)
--> Context (one web applicaiton)
--> Wrapper (one single servlet)
7. 4 interfaces after container.invoke(request, response) method
Pipeline (tasks to be invoked by container, like filter chain) & Valve (One detail execution task, like a filter)
Pipeline.invoke(request, response) same method as container
Valve.invoke(request, response) (Handle received request)
ValveContext.invokeNext() to iterate valves
Contained(阀Valve通过实现该接口至多于一个Servlet相关联): getContriner() & setContainer(container)
8. org.apache.catalina.Mapper映射器: maps between a protocol and a container
wrapper = (Wrapper) context.map(request, true)
9. Lifecycle, LIfecycleEvent & LifecycleListener
Lifecycle.start()/stop(): all components must implements these 2 methods