tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin HaleBoyes <kcbo...@yahoo.com>
Subject behaviour of getRequestDispatcher for bogus URLs
Date Tue, 21 Aug 2001 16:31:34 GMT
What should the behaviour be if I call forward() on
a RequestDispatcher that (I know) doesn't exist?
  (Ya, ya, I get the same behaviour as if I didn't know
   it doesn't exist :-)

For example:

   getServletContext().
      getRequestDispatcher("/I_know_this_page_doesnt_exist.html").
         forward(request, response);

I would expect a NullPointerException but that is not what I get.
Instead, I see the following output in my browser window (Mozilla 0.92):
   <html><body></body></html>
Or "The document contains no data" from Netscape 4.7.
And, if I use lwp-request I get a 404 error which is reasonable.

What "should" I get?

The javadoc for ServletContext says:
   "This method returns null if the ServletContext cannot
    return a RequestDispatcher for any reason."
But I'm not sure what that reason might be given that a bogus URL
doesn't seem to do it.  Also, the spec doesn't say anything about
bad URLs.

Thanks,
Kevin.



____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

Mime
View raw message