Hi,
I have a web application with context root /ServletTest.
The servlet-mapping for one servlet in the application is
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet/*</url-pattern>
</servlet-mapping>
In my web application there is a file called file.html in the web root.
Now, this servlet forward every request. It forwards it to "file.html" using a relative path as follows:
RequestDispatcher dispatcher = request.getRequestDispatcher("file.html");
dispatcher.forward(request, response);
Now when I open the URL http://:/ServletTest/HelloWorldServlet/abc.html,
the browser shows the file file.html. In other words, it has forwarded to
http://:/ServletTest/file.html.
Isn't this behavior wrong? As I understand it, the request should be relative to the servlet path so it should have tried to forward to http://:/ServletTest/HelloWorldServlet/file.html instead.
Is the behavior of JBoss correct (JBoss v. 3.2.3)?
Cheers
Erik