⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testfilter.java

📁 本书是一本为Java学习者在基础内容学习结束后进行课程设计时提供参考的指导书
💻 JAVA
字号:
package apibook.c7.s1;import javax.servlet.*;import java.io.IOException;import javax.servlet.http.*;//测试Filter接口public class TestFilter implements Filter {  FilterConfig config;  public TestFilter() {  }  public void setFilterConfig(FilterConfig config) {    this.config = config;  }  public FilterConfig getFilterConfig() {    return config;  }  public static void main(String[] args) {    TestFilter testFilter1 = new TestFilter();  }  public void init(FilterConfig parm1) throws javax.servlet.ServletException {    /**@todo Implement this javax.servlet.Filter method*/    throw new java.lang.UnsupportedOperationException("Method init() not yet implemented.");  }  public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws java.io.IOException, javax.servlet.ServletException {    ServletContext context = getFilterConfig().getServletContext();    long bef = System.currentTimeMillis();    chain.doFilter(req, res); // no chain parameter needed here    long aft = System.currentTimeMillis();    context.log("Request to " + req.getServerName() + ": " + (aft-bef));//.getRequestURI()  }  public void destroy() {    /**@todo Implement this javax.servlet.Filter method*/    throw new java.lang.UnsupportedOperationException("Method destroy() not yet implemented.");  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -