tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david.l...@oracle.com
Subject Bug re: implementation of RequestDispatcher.forward()
Date Fri, 07 Jul 2000 16:12:07 GMT
I'm using tomcat 3.1 on Windows NT and seem to have found a bug in the
implementation of the forward method of the RequestDispatcher object.

In my simple case below the problem is that the RequestDispatcher is
created successfully (rd is not null), but the attempt to forward
returns a http 404 error (file not found) rather than the file itself.
I've tested that the file can be found by just typing in the same file
path used to create the RequestDispatcher directly into the browser's
address field (the html file is found, no problem).  I've also tested
the same code using Orion and it works fine there.

Thanks,

David

Here's my simple test case code:

import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;

 public class ForwardServlet extends HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    {
      String path = "/test/forward.html";
      RequestDispatcher rd = req.getRequestDispatcher(path);
      System.out.println("path="+path);
      if (rd != null)
      {
        System.out.println("rd is not null!");
      }
      else
      {
        System.out.println("rd is null!");
      }
      System.out.println("forwarding request");
      rd.forward(req, res);
    }

}

My file system looks like:
tomcat
   webapps
        test
           forward.html (just a simple html file, any file will do)

I've verified that tomcat can find the file by typing:
http://my_machine/test/forward.html
into the address field and the file is displayed, so I know tomcat can
find the file.

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message