当前位置: 代码迷 >> Web前端 >> ServletNetSite.java Servlet阻截网站访问
  详细解决方案

ServletNetSite.java Servlet阻截网站访问

热度:151   发布时间:2012-10-24 14:15:58.0
ServletNetSite.java Servlet拦截网站访问
package com.jtang.hospital.servlet;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public abstract class ServletNetSite implements Filter{


private FilterConfig filterConfig=null;

public void init(FilterConfig filterConfig)throws ServletException{
this.filterConfig=filterConfig;

}
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain)throws ServletException,IOException{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out=response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>JSP common examples documents</title>");
out.println("</head>");
out.println("<body>");
out.println("<br>对本站点的访问已经被过滤器过滤<br>");
out.println("</body>");
out.println("</html>");
        chain.doFilter(request, response);
}
public void destory(){

}
}
  相关解决方案