/** http://www-6.ibm.com/jp/developerworks/java/011116/j_j-tomcat.html */ package ushi.svt; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public final class IEFilter implements Filter { private FilterConfig filterConfig = null; private ServletContext sc = null; public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String browserDet = ((HttpServletRequest) request).getHeader("User-Agent").toLowerCase(); sc.log("ブラウザをチェックしています…" + browserDet); if (browserDet.indexOf("msie") != -1){ PrintWriter out = response.getWriter(); out.println(""); out.println("

Sorry, page cannot be displayed!

"); out.println(""); out.flush(); return; } chain.doFilter(request, response); } public void destroy() { sc.log("IEFilterが停止しようとしています。"); } public void init(FilterConfig fc) { this.filterConfig = fc; this.sc = fc.getServletContext(); sc.log("IEFilterが初期化されました。"); } } /* end. */