?? testfilter.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 + -