Tomcat container is a typical case of Chain of Responsibility pattern
Container composed by Engine
Host
Context
Wrapper
connector.getService().getContainer().getPipeline().getFirst().invoke(request, response);
- every container have it’s own pip and valve
- getPipeline() got pipline determine data direction
- getFirst() got valve determine door open or close
- Interface
Valve
have methodinvoke
Engine
engine is top level container, it dispatch request to host
Host
a host represent a virtual machine like ‘localhost’, it store host reference info.
Context
context represent a web project in webapps
Wrapper
wrapper response for a servlet, like load/ init/ resource recycle
1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) |