I'm a complete Tomcat/Apache newb. I'm trying to build a JSP app to run on my company's WAS server. I figured I'd install Tomcat on my home PC and test it there before bringing it into work, but I'm not sure if I have it configured properly. Here's what I have so far:
I installed Tomcat in a directory on my WinXP box - C:\tomcat.
I created a context with path=/mylog and docpath=c:\tomcat\webapps\mylog.
When I point my browser to localhost/mylog, I get my index.jsp page properly.
Now I'm trying to put in a servelet to display the contents of a sub-directory - c:\tomcat\webapps\mylog\logs. I do this with the following code:
File groupDir = new File("./logs");
Instead of getting a sub-directory of /mylog, I get c:\tomcat\logs. According to my searches here on JavaRanch, this is to be expected since all relative paths start from the server path (c:\tomcat, in this case). If I want to point to my application's root path (/mylog), I have to make a call to resource.contextPath() and slap it in front of /logs, i.e.,
File groupDir = new File(resource.contextPath() + "./logs");
Does this sound right? Is there any other way of setting up the server so that relative paths work 'correctly'? Finally, can anyone give me a decent explaination for why the developers would want to confuse me like this