I have a Webapplication and I need refer to a file that is in the appBase directory of a virtual host under Tomcat.
So under standard configuration it would be under <tomcatdir>/webapps
Bbut under a configuration with virtual hosts (tomcat standalone) it could also be in the appBase directory of this virtual host. So if the Host has the appBase "XYZ" it would be under <tomcatdir>/XYZ
When I refer to a file from the jsp the basepath is <tomcatdir>/bin to i would have to refer to "../webapps/file.dat" or "../XYZ/file.dat" or generic "../<appBase>/file.dat"
My Problem now is, that - I don't know what the name of the appbase will be - I can't put a configuration in thw Web.xml deployment descriptor because the people who deploy it will just drop the WAR in the appbase directory. - I can't put the DFile at a place blow the appBase Directory because there will be several instances of this Probram on the same Machine in different Host directories
How can I get the appBase from the JSP at runtime?
It might be not the most elegant way since the file i'm looking for is in the appBase Directory directly and has no URL but I can get the path of the JSP and drill down two directories and get the appBase Dir this way.