📄 requestoverridefilter.java
字号:
package net.java.workeffort.webapp.support;import java.io.IOException;import javax.servlet.Filter;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;import javax.servlet.ServletException;import javax.servlet.ServletRequest;import javax.servlet.ServletResponse;import javax.servlet.http.HttpServletRequest;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;/** * Looks like in some containers (ex Resin, WebSphere), request.getRequestURL() * behaves differently than in other containers. Some containers return the URL * of the initial request, while some other containers return the URL of a * forward if any (Ex: url to the tiles page) . This creates problems in the * datagrid library which is used by the application for pagination and needs * the initial URL. This filter should take care of the problem. See * <code>web.xml</code> for configuration information. * @see RequestWrapper * @author Antony Joseph */public class RequestOverrideFilter implements Filter { private static final Log log = LogFactory .getLog(RequestOverrideFilter.class); /** * {@inheritDoc} */ public void init(FilterConfig filterConfig) { if (log.isInfoEnabled()) log.info("RequestOverrideFilter enabled"); } /** * {@inheritDoc} */ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { RequestWrapper wrapper = new RequestWrapper( (HttpServletRequest) servletRequest); filterChain.doFilter(wrapper, servletResponse); } /** * {@inheritDoc} */ public void destroy() { // nothing to destroy }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -