I have a web application 'testwebapp', with it's document root as /home/user/web. Now, when I try serving a JSP thru the URL http://hostname/testwebapp/pathtojsp.jsp, it works perfectly well. However, I take a look at how the App.Server resolves this request, and I do not understand something.
When I do a application.getRealPath("/"), it gives me the root directory of my web app('/home/user/web'), as it should. When I do 'application.getRealPath("/testwebapp"), what should it show? Shouldn't it show the root directory of the application again? My understanding is that the appserver uses the contextpath(here, hostname/testwebapp), to forward the request to this specific web.app, and hence, application.getRealPath("/testwebapp") should read /home/user/web which is the document root for this web application. Instead, it reads /home/user/web/testwebapp. Is this correct? Is this in accordance with the web application specifications mentioned in Servlet 2.2 specifications? Before I forget, I've tested this across WebSphere, Tomcat and Resin and the behaviour seems to be the same every where. Any insight into this would be greatly appreciated. Thanks.
-Bala.