📄 blockingfilter.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 + -