源码解析
在javaWeb应用开发中,FilterChain是职责链(过滤器)模式的典型应用,以下是Filter的模拟实现分析:
Request.java
package com.itheima.pattern.responsibility.jdk;
/**
* @version v1.0
* @ClassName: Request
* @Description: TODO(一句话描述该类的功能)
* @Author: dym
*/
public interface Request {
}
Response.java
package com.itheima.pattern.responsibility.jdk;
/**
* @version v1.0
* @ClassName: Response
* @Description: TODO(一句话描述该类的功能)
* @Author: dym
*/
public interface Response {
}
Filter.java
package com.itheima.pattern.responsibility.jdk;
/**
* @version v1.0
* @ClassName: Filter
* @Description: TODO(一句话描述该类的功能)
* @Author: dym
*/
public interface Filter {
public void doFilter(Request req,Response res,FilterChain c);
}