This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I need to access file which is above WEB-INF folder from my action class. I dont want to specify the absolute path for this... I even used URL url = new URL("http://localhost:7001/webapps/props/some.xml"); and "http://localhost:7001/" is also absolute ... can anyone tell me how to access the file ?
Files above WEB-INF are inaccessible through the web server interface. It's this way by design, so malicious visitors can't get the source of your pages or Java classes. I usually put files I need access to in WEB-INF/classes and load them with Class.getResourceAsStream().
Originally posted by madhu cm: I think files like propertyfiles , xmls , etc.. should be above WEB-INF ... Not every such files will be placed inside WEB-INF ... Anyway it worked ..
Indeed they ought to be outside the WEB-INF folder. The way I suggested will anyway work for any kind of location be it in or outside WEB-INF. Moreover, the files inside WEB-INF are not accessible through web server interface. That's *my* take.