jsp中的过滤器的问题
package myfiler;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class LoginFilter extends HttpServlet implements Filter {
private FilterConfig filterConfig;
//Handle the passed-in FilterConfig
public void init(FilterConfig filterConfig) throws
ServletException {
this.filterConfig = filterConfig;
}
//Process the request/response pair
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) {
long strattime=System.currentTimeMillis();
String remoteAddress=request.getRemoteAddr();
String remoteHost=request.getRemoteHost();
HttpServletRequest myReq=(HttpServletRequest) request;
String reqURI=myReq.getRequestURI();
System.out.println(reqURI);
try {
request.setAttribute( "URI ", reqURI);
filterChain.doFilter(request, response);
} catch (ServletException sx) {
filterConfig.getServletContext().log(sx.getMessage());
} catch (
IOException iox) {
filterConfig.getServletContext().log(iox.getMessage());
}
filterConfig.getServletContext().log( "发起请求的IP是 "+remoteAddress+ "( "+remoteHost+
"),访问源为 "+reqURI+ "耗时 "+(System.currentTimeMillis()-strattime)+ "ms ");
}
//Clean up resou