Currently I'm preparing for Java EE Web Component Developer exam.
In both exam study guide and Servlet API Java docs I found that method
ServletRequest.getRequestDispatcher()
returns
null if the servlet container cannot return a RequestDispatcher.
When I tried it with non-existent static file I actually got non-null value. And forward resulted in 404 sent to client. Same effect for non-existent servlet. I use Apache Tomcat 7.0.
Does it mean that this behaviour isn't defined and is left to implementer's choice? What do they (Java docs authors) mean by "servlet container cannot return a RequestDispatcher"? I tried to look for it in JSR spec but wasn't able to find answer.