public class ProxyFilter
        implements Filter
{
    @Override
    public void init(FilterConfig filterConfig)
    {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException
    {
        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
        //[设置响应码为302,表示重定向]
        httpServletResponse.setStatus(302);
        //设置新请求的URL
        httpServletResponse.setHeader("Location","http://www.baidu.com" );
    }

    @Override
    public void destroy()
    {
    }
}