第二十章 责任链模式 Chain of Responsibility
作者:互联网
行为型设计模式
定义:
为了避免请求发送者与多个请求处理者耦合在一起,于是将所有请求的处理者通过前一对象记住其下一个对象的引用而连成一条链;当有请求发生时,可将请求沿着这条链传递,直到有对象处理它为止
类图:
应用:
Servlet 定义了过滤器接口 Filter 和过滤器链接口 FilterChain 的源码如下
public interface Filter { public void init(FilterConfig filterConfig) throws ServletException; public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException; public void destroy(); } public interface FilterChain { void doFilter(ServletRequest var1, ServletResponse var2) throws IOException, ServletException; }
标签:throws,Chain,ServletException,void,第二十章,Responsibility,public,FilterChain,请求 来源: https://www.cnblogs.com/hzzjj/p/15368638.html