title: How do I redirect to the current page in Servlet Filter?
body: <p>I have a page say:  <strong>/myapp/test.jsp?queryString=Y</strong>.
  The filter needs to redirect to current page.
  It should go to <strong>/myapp/test.jsp</strong>  (without the query string).
  The below seems to bring it to to the context root:  <strong>/myapp</strong>.
  I am running in WAS6.1.</p>
  
  <pre><code>public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
          HttpServletRequest httpReq = (HttpServletRequest) req;
          HttpServletResponse httpResp = (HttpServletResponse) resp;
  {
     boolean blnNeedToRedirect = true;
     if (blnNeedToRedirect) {
        httpResp.sendRedirect(".");
        return;
     }
  
     chain.doFilter(req, resp);
  }
  </code></pre>