Chris Thanks for taking the time to help me out. I appreciate it. Sorry, my response is kinda wordy. :-P
> If you really REALLY want a file path, you could use the catalina.base system > property or the tmpdir and go from there. The former is Tomcat-specific, of > course, and the tmpdir would be *anywhere*, but if you just really REALLY need > a path on the disk, you could get it from there. Aha! Yes, that could work. >> Also, maybe I'm not asking the right question. How do you all >> configure the location of a special folder that is not part of the >> deployment package itself? A site-specific config file perhaps? > > Well-known location like /etc/myapp/config.cfg? Well-known > configuration URL like https://internal-config.myapp.com/config.cfg? Actually it's Windows. Also, the config file should live in a folder that is (1) obvious and (2) we have access to. >> Currently I'm using getRealPath for a relative-path location > [SNIP] > > If the file can be bundled with the WAR file (which would be best), then you > should get > ServletContext.getResource("/path/rooted/in/the/WAR/file/config.cfg"). Unfortunately it's a site-specific configuration, meaning the value for the setting may be different for each environment, so it really cannot be bundled as-is. The file would need to be tweaked before starting the webapp. Well, I suppose it could be bundled if, after deploying the webapp, we extracted the config file, modified it for the current location, and then reinserted it into the WAR file... But that sounds like a lot of work and not what you intended anyway. ;-) Actually, that's exactly how we handle other custom settings, only without using a WAR file. It's clumsy, and I wish there were a better way of doing it. So instead of having to tweak the configuration after every deployment, we would only do it 1x for the first time the application is installed. That would be great. I'm not sure I understand how to configure a custom resource or am even grasping the concept. Can the resource (config file location) be defined in the application context web.xml? If so, wouldn't it already be too late since that would mean the config file is already bundled with the application? Unless the location of the config file in the resource definition can be expressed as an OS-path (not virtual) to point outside of the webapp's home. Guess I could explain it better. It's a custom report-generation engine. A template file is read by a library, processed, dumped to an output file, then served to the client. There is a folder with template input files and another folder with the output files. Based on what you and Chuck said, it looks like the input templates can be claimed as Resources. Since the library can accept a java.io.InputStream, then the input templates could be included in a WAR file, if we used one. However, the output folder needs to live outside a WAR file, and we need a non-virtual way of specifying the folder (an actual OS path) so the library can write the output there. AND we currently don't use a WAR file. But we could, provided the config file issue can be taken care of. If so, how do you resolve a virtual path to a resource outside the WAR file since it's outside the package "folder" structure of the WAR? Hence the use of getRealPath, so all this configuration juggling can simply be bypassed. I feel like I'm stuck in a "which came first, the chicken or the egg" loop. -- Cris Berneburg CACI Lead Software Engineer --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org