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

📄 blockingfilter.java

📁 Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛2.6版本的源程序
💻 JAVA
字号:
/* * $RCSFile$ * $Revision: 1.5 $ * $Date: 2002/07/14 15:44:39 $ * * Copyright (C) 1999-2002 Jive Software. All rights reserved. * * This software is the proprietary information of Jive Software. * Use is subject to license terms. */package com.jivesoftware.util;import java.io.*;import javax.servlet.*;import com.jivesoftware.forum.*;public class BlockingFilter implements javax.servlet.Filter {    private String errorPage = "/error.html";    public void init(FilterConfig filterConfig) throws ServletException {        // Load up an optional error page        String errorPageParam = filterConfig.getInitParameter("errorPage");        if (errorPageParam != null) {            errorPage = errorPageParam;        }    }    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)            throws IOException, ServletException    {        boolean isBlocking = false;        // Check the value of the Jive property "blockTraffic". It tells        // us if we need to change the mode we're in:        if ("true".equals(JiveGlobals.getJiveProperty("blockTraffic"))) {            isBlocking = true;        }        else {            isBlocking = false;        }        if (isBlocking) {            response.setContentType("text/html");            RequestDispatcher rd = request.getRequestDispatcher(errorPage);            rd.include(request, response);            return;        }        else {            // Move on..            chain.doFilter(request, response);        }    }    public void destroy() {        // Do nothing for now.    }}

⌨️ 快捷键说明

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