I'm attempting to implement a Java-based website using
Servlets and
JSP's. For this, I'm going through a hosting company which uses
Tomcat 4. It should also be noted that this server is running Red Hat Linux (7.2, I believe).
I'm able to get a servlet up and running, but, for the application I'm attempting, I need to be able to open an XML file. This is where I seem to be stuck.
My current directory hierarchy looks something like this:
I have all of my classes arranged ina hierarchy (by package) under the WEB-INF/classes directory. I have my jsp(s) inside the jsp directory, and I have an xml file within the xml directory. However, I'm having trouble accessing that xml file.
Currently, I have the following code within my servlet:
This should set returnVal to true if the file is there and false otherwise. However, I continually get a AccessControlException.
My hunch is that, by putting the '/' prior to the xml directory, the application may be searching for the file at the root level, which is where the security issue comes in. How can I make it start looking at the level of the application context, which is set to /var/www/html (where the WEB-INF directory is located).
Anyone have any ideas about how I can accomplish this? It doesn't seem as if it should be that difficult to access a file, but I sure seem to be having problems with it.
Thanks,
Corey